akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(){
    int N,A,B, i, temp, t, remainder, sum, total = 0;
    scanf("%d %d %d", &N,&A,&B);

    for(i = 1; i <= N; i++){
        t = i;
        sum  = 0;
        while (t != 0){
              remainder = t % 10;
              sum += remainder;
              t /= 10;
           }

           if(sum >= A && sum <= B){
               total += i;
        }
    }

    printf("%d", total);

}

Measured memory_bytes: 1708
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

#[allow(dead_code)]
struct Scanner<'a> {
    cin: StdinLock<'a>,
}
#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self
            .cin
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn input<T: FromStr>(&mut self) -> T {
        self.read().unwrap()
    }

    fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.input()).collect()
    }

    fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let n: usize = sc.input();
    let k: usize = sc.input();
    let mut arr: Vec<i64> = sc.vec(n);
    const MOD: i64 = 1_000_000_007;

    arr.sort();

    let com = Combination::new(200_001, MOD as usize);

    let mut ans: i64 = 0;
    for i in 0..n {
        ans += arr[i] * com.com(i, k - 1) as i64 % MOD;
        ans -= arr[i] * com.com(n - 1 - i, k - 1) as i64 % MOD;
        ans = (ans % MOD + MOD) % MOD;
    }
    println!("{}", ans);
}
struct Combination {
    max_n: usize,
    modulo: usize,
    fac: Vec<usize>,
    finv: Vec<usize>,
    inv: Vec<usize>,
}

impl Combination {
    fn new(max_n: usize, modulo: usize) -> Combination {
        let mut fac = vec![0; max_n];
        let mut finv = vec![0; max_n];
        let mut inv = vec![0; max_n];
        fac[0] = 1;
        fac[1] = 1;
        finv[0] = 1;
        finv[1] = 1;
        inv[1] = 1;
        for i in 2..max_n {
            fac[i] = fac[i - 1] * i % modulo;
            inv[i] = modulo - inv[modulo % i] * (modulo / i) % modulo;
            finv[i] = finv[i - 1] * inv[i] % modulo;
        }
        Combination {
            max_n: max_n,
            modulo: modulo,
            fac: fac,
            finv: finv,
            inv: inv,
        }
    }

    fn com(&self, n: usize, k: usize) -> usize {
        if n < k {
            0
        } else {
            self.fac[n] * (self.finv[k] * self.finv[n - k] % self.modulo) % self.modulo
        }
    }

    fn hcom(&self, n: usize, k: usize) -> usize {
        if n == 0 && k == 0 {
            1
        } else {
            self.com(n + k - 1, k)
        }
    }
}


Measured memory_bytes: 10492
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <iomanip>

using namespace std;

int main()
{
    int N, A, B;
    long long C[51][51] = {0};
    long long t, ans = 0;
    int X, Y;
    vector<long long> v(51);

    for (int i = 0; i <= 50; i++) {
        for (int j = 0; j <= i; j++) {
            if(j == 0 or j == i)
                C[i][j] = 1LL;
            else
                C[i][j] = C[i-1][j-1] + C[i-1][j];
        }
    }

    cin >> N >> A >> B;

    for(int i = 0; i < N; i++)
        cin >> v[i];

    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());

    t = v[A-1];

    X = count(v.begin(), v.end(), t);
    Y = count(v.begin(), v.begin()+A, t);

    if (v[0] != v[A-1])
        ans = C[X][Y];
    else {
        for (int i = A; i <= B; i++) {
            if (i <= X)
                ans += C[X][i];
        }
    }

    cout << setprecision(10) << (accumulate(v.begin(), v.begin()+A, 0.0)) / A << endl;
    cout << ans << endl;

    return 0;
}

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

using namespace std;

const int MOD = 1000000007;

int main(){
    int N, K;
    while(cin >> N >> K){
        if(K%2 == 1){
            cout << 0 << endl;
            continue;
        }
        vector<vector<long long>> dp(N+1, vector<long long>(N*N/2+1, 0));
        dp[0][0] = 1;
        for(int i=0;i<N;i++){
            vector<vector<long long>> next(N+1, vector<long long>(N*N/2+1, 0));
            for(int j=0;j<=N;j++){
                for(int k=0;k<=N*N/2;k++){
                    for(int d=-1;d<=1;d++){
                        if(j+d < 0 || N < j+d) continue;
                        if(k+j+d > N*N/2) continue;
                        next[j+d][k+j+d] += (d == -1 ? j*j : d == 0 ? 2*j+1 : 1) * dp[j][k];
                        next[j+d][k+j+d] %= MOD;
                    }
                }
            }
            dp = next;
        }
        cout << dp[0][K/2] << endl;
    }
}

Measured memory_bytes: 1312
S=list(input())
N=len(S)
check=True
for i in range(N//2):
    if S[i]!=S[N-1-i]:
        check=False
        break
if check==False:
    print("No")
else:
    C=False
    for i in range((N//2)//2):
        if S[i]!=S[N//2-1-i]:#0123456
          C=True
          break
    if C==True:
        print("No")
    else:
        print("Yes")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

signed main(){

  vector<int> v(7);
  for(int i = 1; i <= 6; i++){
    cin >> v[i];
  }

  vector<int> dp(v[6]), dp2(v[6]);
  dp[0] = dp2[0] = 1;
  for(int i = 0; i + max(v[1], v[2]) < v[6]; i++){
    dp[i + v[1] * 100] |= dp[i];
    dp[i + v[2] * 100] |= dp[i];
  }
  for(int i = 0; i + max(v[3], v[4]) < v[6]; i++){
    dp2[i + v[3]] |= dp2[i];
    dp2[i + v[4]] |= dp2[i];
  }

  double t = -1;
  pair<int, int> ans = make_pair(v[1] * 100, 0);
  for(int i = 100; i < dp.size(); i++){
    for(int j = 1; j < dp2.size(); j++){
      if(dp[i] & dp2[j]){
        double res = (double)j * 100 / i;
        if(i + j <= v[6] && res <= v[5]){
          if(res > t){
            t = res;
            ans = {i + j, j};
          }
        }
      }
    }
  }
  cout << ans.first << " " << ans.second << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
int a,b,c,d,e,f;
scanf("%d %d %d",&a,&b,&c);
d=10*a+b+c;
e=10*b+c+a;
f=10*c+a+b;
if(e>d&&e>f) printf("%d",e);
else if(d>f) printf("%d",d);
else printf("%d",f);



return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
int main(){
  int k,s,cnt=0;
  scanf("%d%d", &k ,&s);
  for(int x=0; x<=k; x++){
    for(int y=0; y<=k; y++){
      int z = s - x- y;
      if( z >= 0 && z <= k ){ cnt++; }
    }
  }
  printf("%d",cnt);
  return 0;
}

Measured memory_bytes: 1708
//H and V

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define irep(i,a) for(auto i = a.begin(); i != a.end(); ++i)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using p = pair<ll, string>;
using garph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    int h,w,k;cin>>h>>w>>k;
    vecrep(h,c,string);
    int ans = 0;
    for(int bit = 0;bit<(1<<h);bit++){
        for(int bitt = 0;bitt<(1<<w);bitt++){
            int q = 0;
            for(int i=0;i<h;i++){
                for(int j=0;j<w;j++){
                    if(bit&(1<<i)&&bitt&(1<<j)){
                        if(c[i][j]=='#')q++;
                    }
                }
            }
            if(q==k)ans++;
        }
    }
    cout<<ans<<nnn;
    return 0;
}

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

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int array[][] = new int[3][n + 1];
        for(int i = 1;i <= 2;i++){
            String str = br.readLine();
            for(int j = 1;j <= n;j++)
                array[i][j] = str.charAt(j - 1);
        }
        String str = "";
        for(int i = 1;i < n;i++){
            if(array[1][i] == array[1][i + 1]){
                str += 'Y';
                ++i;
                continue;
            }
            else str += 'X';
            if(i == n - 1)str += 'X';
        }
        long ans;
        long mod = (long)1E9 + 7;
        if(str.length() == 0 || str.charAt(0) == 'X')
            ans = 3;
        else ans = 6;
        for(int i = 1;i < str.length();i++){
            if(str.charAt(i - 1) == 'X' && str.charAt(i) == 'Y')ans *= 2;
            if(str.charAt(i - 1) == 'X' && str.charAt(i) == 'X')ans *= 2;
            if(str.charAt(i - 1) == 'Y' && str.charAt(i) == 'Y')ans *= 3;
            while(ans >= mod)ans -= mod;
        }
        System.out.println(ans);
    }
}


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

namespace otoshidama
{
	public class Program
	{
		public static void Main(string[] args)
		{
			var arg = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
			var ret = TestOtoshidama(arg[0], arg[1]);
			Console.WriteLine($"{ret[0]} {ret[1]} {ret[2]}");
		}

		public static int[] TestOtoshidama(int n, int y)
		{
			int a = 10000;
			int b = 5000;
			int c = 1000;

			int aMax = y / a;

			if(aMax > n || n * c > y) {
				return new int[] { -1, -1, -1 };
			}

			for(int i = 0; i <= aMax; i++) {
				for(int j = 0; j <= n - i; j++) {
					if((a * i) + (b * j) + (c * (n - i - j)) == y) {
						return new int[] { i, j, n - i - j };
					}
				}
			}

			return new int[] { -1, -1, -1 };
		}
	}
}


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

ll dp[10][1001];//?????£????????°,???

int main() {
	dp[0][0] = 1;
	for (int i = 0; i <= 100; i++) {
		for (int j = 1000; j >= i; j--) {
			for (int k = 9; k > 0; k--) {
				dp[k][j] += dp[k - 1][j - i];
			}
		}
	}
	int n, s;
	while (cin >> n >> s, n) {
		cout << dp[n][s] << endl;
	}
	return 0;
}

Measured memory_bytes: 3208
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
  cin>>n;
long int a[n];
for(int i=0; i<n; i++){
  int t;
  cin>>t;
  a[i]=t;}

int max, min, flag;

if(n==1){
  cout<<"Yes"<<endl;}
else{
max=a[n-1];
min=a[n-1];
flag=0;
for(int i=n-2; i>=0; i--){
  if(a[i]<min)
    min=a[i];
  
  if((a[i]-min)>=2){
    cout<<"No"<<endl;
    flag=1;break;}
}
if(flag==0){cout<<"Yes"<<endl;}
}

  
} 


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define LOCAL
#pragma region Macros
typedef long long ll;
#define ALL(x) (x).begin(),(x).end()
const long long MOD=1e9+7;
// const long long MOD=998244353;
const int INF=1e9;
const long long IINF=1e18;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
const char dir[4]={'D','R','U','L'};

template<typename T>
istream &operator>>(istream &is,vector<T> &v){
    for (T &x:v) is >> x;
    return is;
}
template<typename T>
ostream &operator<<(ostream &os,const vector<T> &v){
    for (int i=0;i<v.size();++i){
        os << v[i] << (i+1==v.size()?"": " ");
    }
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const pair<T,U> &p){
    os << '(' << p.first << ',' << p.second << ')';
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const map<T,U> &m){
    os << '{';
    for (auto itr=m.begin();itr!=m.end();++itr){
        os << '(' << itr->first << ',' << itr->second << ')';
        if (++itr!=m.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os,const set<T> &s){
    os << '{';
    for (auto itr=s.begin();itr!=s.end();++itr){
        os << *itr;
        if (++itr!=s.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}

void debug_out(){cerr << '\n';}
template<class Head,class... Tail>
void debug_out(Head&& head,Tail&&... tail){
    cerr << head;
    if (sizeof...(Tail)>0) cerr << ", ";
    debug_out(move(tail)...);
}
#ifdef LOCAL
#define debug(...) cerr << " ";\
cerr << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << '\n';\
cerr << " ";\
debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<typename T> T gcd(T x,T y){return y!=0?gcd(y,x%y):x;}
template<typename T> T lcm(T x,T y){return x/gcd(x,y)*y;}

template<class T1,class T2> inline bool chmin(T1 &a,T2 b){
    if (a>b){a=b; return true;} return false;
}
template<class T1,class T2> inline bool chmax(T1 &a,T2 b){
    if (a<b){a=b; return true;} return false;
}
#pragma endregion

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    S+='$';
    int cnt=0,ans=0;
    for (int i=0;i<4;++i){
        if (S[i]=='R') ++cnt;
        else ans=max(ans,cnt),cnt=0;
    }
    cout << ans << '\n';
}

Measured memory_bytes: 3652
#include <iostream>
#include <string>

using namespace std;

int main(){

    int N;
    cin >> N;

    int count = 0;
    for(int i = 1; i <= N; i++){
        string s = to_string(i);
        if(s.length() % 2) count++;
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int S, h, m, s;
    scanf("%d", &S);
    scanf("%d %d %d", &h, &m, &s);
    h = S / 3600;
    m = (S - (h * 3600)) / 60;
    s = S - (h * 3600 + m * 60);
    printf("%d:%d:%d\n", h, m, s);
    return 0;
}



Measured memory_bytes: 2104
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
char s[200005];
int n;
int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	int ans=0;
	for(int i=1;i<=n;i++){
		ans+=s[i]-'0';
	}
	puts(ans%9?"No":"Yes");
	return 0;
}

Measured memory_bytes: 1848
# -*- coding: utf-8 -*-
n = int(input())
d = {}

for _ in range(n):
    s = "".join(sorted(list(input())))
    if s not in d:
        d[s] = 0
    d[s] += 1

res = 0
for k in d:
    n = d[k]
    res += n*(n-1)//2

print(res)


Measured memory_bytes: 17808
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define req(i,n,m) for(int i=n;i<m;i++)
#define REQ(i,n,m,l) for(int i=n;i<m;i+=l) 
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
signed gcd(int x, int y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
signed lcm(int x, int y) {
    return x / gcd(x, y) * y;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
    int A, B, K; cin >> A >> B >> K;
    rep(i, K) {
        if (i % 2 == 0) {
            if (A % 2 == 0) {
                B += A / 2;
                A /= 2;
            }
            else {
                B += A / 2;
                A /= 2;
            }
        }
        else {
            if (B % 2 == 0) {
                A += B / 2;
                B /= 2;
            }
            else {
                A += B / 2;
                B /= 2;
            }
        }
    }
    cout << A << " " << B << endl;
}

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

int main() {
  int N;
  cin >> N;
  
  for(int i = 0;i < N;i++){
    string s;
    cin >> s;
     if(s == "Y"){
      cout << "Four" << endl;
      break;
    }
    
    if(i == N - 1){
      cout << "Three" << endl;
    }
  }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    int K = sc.nextInt();
    int i=1, ans =0;
    while (true) {
      if ((long)N < Math.pow(K,i)) { 
        ans = i;
        break;
      }
      i++;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 22740
#include <bits/stdc++.h>
using namespace std;
#pragma region
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << (#x) << "] = [", _print(x)
#else
#define debug(x...)
#endif
#pragma endregion
typedef long long ll;
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define sz(v) int((v).size())
#define int ll
#pragma region
#define f first
#define s second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#pragma endregion

int n, k, c;
string s;
void solve()
{
    cin>>n>>k>>c>>s;
    //
    vector<int> l;
    int rm = k;
    forn(i, n)
    {
        if (s[i] == 'o')
        {
            --rm;
            l.pb(i);
            i += c;
        }
        if (rm == 0) break;
    }
    vector<int> r;
    rm = k;
    for (int i=n-1;i>=0;--i)
    {
        if (s[i] == 'o')
        {
            --rm;
            r.pb(i);
            i -= c;
        }
        if (rm == 0) break;
    }
    reverse(r.begin(), r.end());
    forn(i, k) if (l[i] == r[i]) cout << l[i] + 1 << '\n';
}

signed main()
{
    int T = 1;
    ios_base::sync_with_stdio(0); cin.tie(0);
    //cin >> T;
    for(int i=1;i<=T;++i)
    {
        //cout << "Case #" << i << ": ";
        solve();
    }
    return 0;
}


Measured memory_bytes: 8124
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanInt()
	}
	return a
}

func debug(a ...interface{}) {
	if os.Getenv("ONLINE_JUDGE") == "false" {
		fmt.Fprintln(os.Stderr, a...)
	}
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n, k := scanInt(), scanInt()
	l, r := make([]int, k), make([]int, k)
	for i := 0; i < k; i++ {
		l[i], r[i] = scanInt(), scanInt()
	}
	a := make([]int, n)
	b := make([]int, n*2+1)
	a[0] = 1
	p := 0
	for i := 0; i < n; i++ {
		p += b[i]
		p %= mod
		a[i] += p
		for j := 0; j < k; j++ {
			b[i+l[j]] += a[i]
			b[i+l[j]] %= mod
			b[i+r[j]+1] -= a[i]
			b[i+r[j]+1] %= mod
		}
	}
	fmt.Fprintln(wr, (a[n-1]+mod)%mod)
}

const mod = 998244353


Measured memory_bytes: 6672
import math
Q = int(input())
is_prime = [False] * (10**5+1)
is_prime[2] = True
is_like_2017 = [0] * (10**5+1)
for i in range(3, 10**5+1, 2):
    is_like_2017[i] = is_like_2017[i-2]
    for j in range(3, math.floor(math.sqrt(i))+1, 2):
        if i % j == 0:
            break
    else:
        is_prime[i] = True
        if is_prime[(i+1)//2]:
            is_like_2017[i] += 1
for _ in range(Q):
    l, r = map(int, input().split())
    if l-2 >= 0:
        print(is_like_2017[r] - is_like_2017[l-2])
    else:
        print(is_like_2017[r])


Measured memory_bytes: 52700
#include <iostream>

using namespace std;

int main(){
    int A,B;
    scanf("%d",&A);
    scanf("%d",&B);

    if(A!=1&&B!=1){
        cout<<1<<endl;
    }else if(A!=2&&B!=2){
        cout<<2<<endl;
    }else if(A!=3&&B!=3){
        cout<<3<<endl;
    }


}

Measured memory_bytes: 256
#include <stdlib.h>
#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,d;
    cin>>a>>b>>c>>d;
    vector<int> veca(a);
    rep(i,a){
        cin>>veca.at(i);
    }
    vector<int> vecb(b);
    rep(i,b){
        cin>>vecb.at(i);
    }
    int max = *std::max_element(veca.begin(), veca.end());
    int min = *std::min_element(vecb.begin(), vecb.end());
    //cout<<max<<min<<endl;
    if(min>max){
        if(c<min&&min<d){
            cout<<"No War"<<endl;
        }
        else{
            cout<<"War"<<endl;
        }
    }
    else{
        cout<<"War"<<endl;
    }
    
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 105;
const int INF  = 1e9;
typedef long long ll;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
char s[MAXN][MAXN];
int n, m, dp[MAXN][MAXN];
int main() {
	read(n), read(m);
	for (int i = 1; i <= n; i++)
		scanf("%s", s[i] + 1);
	for (int i = 1; i <= n; i++)
	for (int j = 1; j <= m; j++) {
		int ans = INF;
		if (i + j == 2) ans = 0;
		if (i > 1) chkmin(ans, dp[i - 1][j] + (s[i][j] != s[i - 1][j]));
		if (j > 1) chkmin(ans, dp[i][j - 1] + (s[i][j] != s[i][j - 1]));
		dp[i][j] = ans;
	}
	int res = dp[n][m] + (s[1][1] == '#') + (s[n][m] == '#');
	assert(res % 2 == 0);
	cout << res / 2 << endl;
	return 0;
}


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

#define fr(i,b,e) for(int i=(b); i!=(e); ++i)
#define rep(i,e) for(int i=0; i!=(e); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long int li;
typedef long long int ll;
using graph = vector<vector<int>>;
using edgedp = vector<vector<pair<int,ll>>>;
constexpr int INF=1000000;
//constexpr int MOD=998244353;
constexpr int MOD=1e9+7;




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

    ll a,b,c,k;
    cin >> a >> b >> c >> k;
    ll out=0;

    if(a>=k){
        cout << k << "\n";
    }else if(a+b >=k){
        cout << a << "\n";
    }else{
        k=k-(a+b);
        cout << a-k << "\n";
    }
}   




Measured memory_bytes: 3648
//from PKU1125
main(){
	int i,n,k,a,b,A,B,dist[101][101];
	scanf("%d%d",&n,&k);
		/*initialize*/
		memset(dist,11,sizeof(dist));
		for(i=1;i<=n;i++)dist[i][i]=0;
		for(;k;k--){
			scanf("%d,%d,%d,%d",&a,&b,&A,&B);
			dist[a][b]=A,dist[b][a]=B;
		}

		{/*warshall-floyd*/
			int k,i,j;
			for(k=1;k<=n;k++)
				for(i=1;i<=n;i++)
					for(j=1;j<=n;j++)
						if(dist[i][j]>dist[i][k]+dist[k][j])
							dist[i][j]=dist[i][k]+dist[k][j];
		}

		{/*query*/
			scanf("%d,%d,%d,%d",&a,&b,&A,&B);
			printf("%d\n",A-B-dist[a][b]-dist[b][a]);
		}
	exit(0);
}

Measured memory_bytes: 644
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int N;
  cin >> N;
  vvi G(N,vi(N,0));
  rep(i,N) {
    string s;
    cin >> s;
    rep(j,N) {
      if(s[j]=='1') {
        G[i][j]++;
      }
    }
  }
  int ans = -1;
  rep(i,N) {
    int res = -1;
    Q que;
    vi d(N,INF);
    d[i] = 0;
    que.push(i);
    while(!que.empty()) {
      int t = que.front();
      que.pop();
      res = max(res,d[t]+1);
      rep(j,N) {
        if(!G[t][j]) continue;
        if(d[j] != INF) continue;
        d[j] = d[t]+1;
        que.push(j);
      }
    }
    bool ok = true;
    rep(j,N) {
      rep(k,N) {
        if(!G[j][k]) continue;
        if(abs(d[j]-d[k])!=1) {
          ok = false;
        }
      }
    }
    if(ok) {
      ans = max(ans,res);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
#define fil(x) memset(x, 0, sizeof(x))
#define fillb(x) memset(x,false,sizeof(x))
#define fillm(x) memset(x, -1, sizeof(x))
#define mp make_pair
#define pll pair<int, int>
#define pf printf
#define sf scanf
#define all(x) x.begin(),x.end()
#define pb push_back
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define np std::string::npos
#define fo(i,n) for(int i=0;i<n;i++)
#define fo1(i,n) for(int i=1;i<n;i++)
#define fof(i,a,b) for(int i=a;i<=b;i++)
#define off(i,a,b) for(int i=a;i>=b;i--)
#define of(i,n) for(int i=n-1;i>=0;i--)
#define stl(i,x) for(auto i=x.begin(); i!=x.end();i++)
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define cases(cs,t) for(int cs=1;cs<=t;cs++)
#define PI acos(-1)
#define nl endl

typedef unsigned long long lll;
typedef long long ll;
int knigtx8[] = {2, 2, -2, -2, 1, 1, -1, -1}; ///knight move in chess
int knigty8[] = {1, -1, 1, -1, 2, -2, 2, -2}; ///knight move in chess
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}; ///for 8 directions
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1}; ///for 8 directions
int dx4[] = {0, 0, 1, -1}; ///for 4 directions
int dy4[] = {1, -1, 0, 0}; ///for 4 directions
const int maxx=100005;

//this fuction sorts vector pair according to first element in descending order.
bool sortinrev(const pair<int,int> &a,const pair<int,int> &b)
{
    return a.first>b.first;
}
ll pw(ll a, ll b)
{
    ll ans = 1;
    for(ll i = 1; i <= b; ++i)
        ans = (ans * a);
    return ans;
}
template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}

int main()
{
    IOS;
    int a,b,c,k,cnt=0;
    cin>>a>>b>>c>>k;
    while(a>=b){
        cnt++;
        b*=2;
    }
    while(b>=c){
        cnt++;
        c*=2;
    }
    if(cnt>k)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    return 0;
}

///Alhamdulillah


Measured memory_bytes: 3644
import java.util.*;
public class Main {
	
	static int mod = (int)1e9+7;
	
	public static void main(String[] args) {		
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long A[] = new long[N];
		for(int i=0;i<N;i++)A[i]=sc.nextLong();
		sc.close();
		
//		//test modpow
//		System.out.println(modpow(7,0));
//		System.out.println(modpow(2,4));
//		System.out.println(modpow(3,5));
//		if(true)return;
		
		long ans = 0;
		for(int i=0;i<60;i++) {
			int cnt = 0;
			for(int j=0;j<N;j++) {
				if(((A[j]>>i)&1)==1) cnt++;
			}
			long tmp = (long)cnt*(N-cnt) %mod;
			//ans += tmp<<i;　これだとオーバーフローする
			long mul = (long)Math.pow(2, i) % mod;
			ans += (tmp * mul % mod);
			ans %= mod;	
		}
		System.out.println(ans);
	}
	
	//不要のはず
	static long modpow(long x, long y) {
		if(y==0) return 1;
		if(y%2==0) {	
			long halfY = y/2;
			long root = modpow(x, halfY);
			return root*root %mod;
		}else {
			return x * modpow(x, y-1) % mod;
		}
	}
	
}

Measured memory_bytes: 99676
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include <cmath>
//#include <bits/stdc++.h>
using namespace std;

int main(){
    long int K,N;
    cin>>K>>N;
    long int A[N],B[N],x=0;
    for (int i=0;i<N;i++){
        cin>>A[i];
    }
    for (int i=0;i<N-1;i++){
        B[i]=A[i+1]-A[i];
        if (x<B[i]) x=B[i];
    }
    B[N-1]=K-(A[N-1]-A[0]);
    if (x<B[N-1]) x=B[N-1];
    cout<<K-x<<endl;
    return 0;
}


Measured memory_bytes: 3456
#include <cstdio>
#include <queue>
#include <iostream>
#include <algorithm>
using namespace std;
long long a[2000100];
long long ans[100010];
long long s[2000100];
int main()
{
    int n;
    cin >> n;
    long long sum=0;
    for(int i=1;i<=n;i++)
    {
        cin >> a[i];
        sum += a[i];
    }
    for(int i=n+1;i<=2*n;i++)
    {
        a[i] = a[i-n];
    }
    int c=1;
    for(int i=1;i<=n/2;i++)
    {
        s[1] += a[1+c];
        s[2] += a[2+c];
        c +=2;
    }
    for(int i=3;i<=n;i+=2)
    {
        s[i] = s[i-2] - a[i-1] + a[i+2*(n/2-1)+1];
    }
    for(int i=4;i<=n;i+=2)
    {
        s[i] = s[i-2] - a[i-1] + a[i+2*(n/2-1)+1];
    }
    for(int i=1;i<=n;i++)
    {
        ans[i] = sum - 2*s[i];
        cout << ans[i] << " ";
    }
    return 0;
}

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

int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	while(1)
	{
		c=c-b;
		if(c<=0)
		{
			cout<<"Yes";
			return 0;
		}
		a=a-d;
		if(a<=0)
		{
		  cout<<"No";
		  return 0;
		}
	}
}

Measured memory_bytes: 3624
#include <cstdio>

#define ll long long

int main() {
    ll n = 1;
    char b;
    char ch = fgetc(stdin);
    char a = ch;
    while (ch != '\n') {
        b = ch;
        ch = fgetc(stdin);
        n++;
    }
    if (a == b) {
        if (n % 2 == 1)
            printf("First");
        else
            printf("Second");
    }
    else {
        if (n % 2 == 0)
            printf("First");
        else
            printf("Second");
    }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
 
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define int         ll int
#define float       double
#define	endl		'\n'
#define maxpq       priority_queue<ll>
#define minpq       priority_queue<ll, vector<ll>, greater<ll> >
#define mii         map<int,int>
#define msi         map<string,int>
#define mis         map< int, string>
#define mpi         map<pair< int, int>, int>
#define pii         pair< int, int>
#define vi          vector< int>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define EPS         1e-9
#define INF         1e18
#define PI          3.14159265358979323846
#define MAXI        1000000
#define what_is(x)  cerr << #x << " is " << x << endl;
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
#define N 100005
int modexp(int x,int n,int mod){
	x%=mod;
	int res=1;
	while(n>0){
		if(n&1) res=res*x%mod;
		x=x*x%mod;
		n/=2;
	}
	return res;
}
int modInverse(int n, int p)
{ 
    return modexp(n, p - 2, p); 
} 
int nCr(int n,int r, int p) 
{ 
    if (r == 0) 
        return 1; 
    int fac[n + 1]; 
    fac[0] = 1; 
    for (int i = 1; i <= n; i++) 
        fac[i] = (fac[i - 1] * i) % p; 
  
    return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p; 
} 
signed main()
{
	fast;
	int t=1;
	//cin>>t;
	while(t--)
	{
		int n;
		cin>>n;
		if(n>=30) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
   }
   return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <utility>
#include <random>
#include <chrono>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

using namespace std;

using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using PIL = pair<int, LL>;
using PLL = pair<LL, LL>;
// const int mod = 1e9 + 7;
// const int mod = 998244353;

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

int valid[200010];
int l[200010], r[200010];
int b[200010];
int n, x;

inline void work() {
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> x;
        if (!l[x]) {
            l[x] = i;
        }
        r[x] = i;
    }
    for (int i = 1; i <= n; ++i) {
        cin >> b[i];
        if (l[b[i]]) {
            // cout << "b[i] = " << b[i] << " " << l[b[i]] << " " << r[b[i]] << "\n";
            int lth = l[b[i]] - i;
            int rth = r[b[i]] - i;
            if (lth < 0) {
                lth += n;
            }
            if (rth < 0) {
                rth += n;
            }
            // cout << "l, r = " << lth << "," << rth << "\n";
            if (lth <= rth) {
                ++valid[lth];
                --valid[rth + 1];
            }
            else {
                ++valid[lth];
                ++valid[0];
                --valid[rth + 1];
            }
        }
    }
    bool find = false;
    int sum = 0;
    for (int i = 0; i < n; ++i) {
        sum += valid[i];
        if (sum == 0) {
            cout << "Yes\n";
            for (int j = (i == 0 ? 1 : n - i + 1), cnt = 0; cnt < n; ++cnt) {
                cout << b[j] << " ";
                ++j;
                if (j == n + 1) {
                    j = 1;
                }
            }
            cout << "\n";
            find = true;
            break;
        }
    }
    if (!find) {
        cout << "No\n";
    }
}

int main() {
    // freopen("input.txt", "r", stdin);
    quickread();
    work();
    return 0;
}

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

#define ll long long
#define endl "\n"

int main ()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	string s;
	cin >> s;
	int q;
	cin >> q;

	deque <char> letters;
	bool initial = true;
	for (auto &c : s) {
		letters.push_back(c);
	}

	while (q--) {
		int op;
		cin >> op;

		if (op == 1) {
			initial ^= 1;
		}

		else {
			cin >> op;
			char now;
			cin >> now;
			if (op == 1) {
				if (initial) {
					letters.push_front(now);
				}
				else letters.push_back(now);
			}
			else {
				if (initial) {
					letters.push_back(now);
				}
				else letters.push_front(now);
			}
		}
	}

	if (initial) {
		while (letters.size()) {
			cout << letters.front();
			letters.pop_front();
		}
	}

	else {
		while (letters.size()) {
			cout << letters.back();
			letters.pop_back();
		}
	}

	return 0;
}


Measured memory_bytes: 4020
//written by NewbieChd
#include <iostream>
#include <algorithm>
using namespace std;

const int maxN = 100003;
string str[maxN];
int val[maxN], ind[maxN];
inline bool cmp(int x, int y) { return str[x] != str[y] ? str[x] < str[y] : val[x] > val[y]; }

int main() {
    int n, i;
    cin >> n;
    for (i = 1; i <= n; ++i)
        cin >> str[i] >> val[i], ind[i] = i;
    sort(ind + 1, ind + n + 1, cmp);
    for (i = 1; i <= n; ++i)
        printf("%d\n", ind[i]);
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;
#define int ll

#define For(i,a,b)  for(int i=a;i<=b;i++)
#define Forr(i,a,b) for(int i=a;i>=b;i--)
#define F first
#define S second

#define eb emplace_back
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())

#define MOD (ll)(1e9+7)
#define INF (1e18)
#define EPS (1e-6)

#ifdef LOCALMEOW
#define debug(...) do{\
	cerr << __PRETTY_FUNCTION__ << " - " << __LINE__ <<\
	" : ("#__VA_ARGS__ << ") = ";\
	_OUT(__VA_ARGS__);\
}while(0)
template<typename T> void _OUT(T x) { cerr << x << "\n"; }
template<typename T,typename...I>
void _OUT(T x,I ...tail) { cerr << x << ", "; _OUT(tail...); }
#else
#define debug(...)
#endif
void INIT(){ ios::sync_with_stdio(false); cin.tie(0); }

int val[100010][3];
int dp[100010][3];

int32_t main(){
	//code...
	int n; cin>>n;
	For(i,0,n-1) For(j,0,2){
		cin>>val[i][j];
	}
	For(i,0,2) dp[0][i]=val[0][i];
	For(i,1,n-1) For(j,0,2){
		dp[i][j]=val[i][j]+max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3]);
	}
	cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]})<<"\n";
	return 0;
}
























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

int main(){
  int n;
  cin >> n;
  int k = n;
  int a,b;
  cin >> a >> b;
  while(1){
    if(a<=k&&k<=b){
      cout << "OK" << endl;
      return 0;
    }
    else if(b<k){
      cout << "NG" << endl;
      return 0;
    }
    k += n;
  }
  return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>
long long int po(long long int x){
    if(x==0)return 1;
    if(x%2==0) return (po(x/2)%1000000007)*(po(x/2)%1000000007);
    else return 2*(po(x-1)%1000000007);
}

int main(){
    int n;
    scanf("%d",&n);
    int a,i;
    int count[n];
    for(i=0;i<=n-1;i++)count[i]=0;
    for(i=0;i<=n-1;i++){
        scanf("%d",&a);
        count[a]+=1;
    }
    int flag=0;
    if(n%2==0) {
        for(i=0;i<=n/2-1;i++){
            if(count[2*i+1]!=2)flag=1;
        }
    }else{
        if(count[0]!=1)flag=1;
        for(i=1;i<=n/2;i++){
            if(count[2*i]!=2)flag=1;
        }
    }
    if(flag==1)printf("0");
    else printf("%lld",(po(n/2)%1000000007));
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>
#include <cstring>

using namespace std;

typedef pair<int, int> P;
#define mp make_pair
#define FOR(i, a, b) for(int (i)=a;(i)<(b);++(i))
#define rep(i, n)  FOR(i,0,n)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort((v).begin(), (v).end());					//小さい順
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());		//大きい順
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define all(c) (c).begin(),(c).end()
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define F first
#define S second
#define pb push_back
#define mod 1000000007LL
#define INF 1234567890

const int maxn = 2e5 + 10;


//initialization here
//
ll a[maxn];

//
//initialization finish


// your function is here
//



//
// your function finished



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

	// your code is here
	//
	
	int a[3];
	rep(i, 3) cin >> a[i];

	sort(a, a + 3);

	if (a[0] + a[1] == a[2]) Yes;
	else No;


	//
	// your code finished

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
template<class T> bool chmax(T &a, const T &b) { if(a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if(a > b) { a = b; return true; } return false; }
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using ii = pair<int, int>;
using vvi = vector<vi>;
using vii = vector<ii>;
using gt = greater<int>;
using minq = priority_queue<int, vector<int>, gt>;
using P = pair<ll,ll>;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 

ll A,B;
int main() {
  cin >> A >> B;
  ll ans = 0;
  auto f = [](ll n) {
    if (n == 0) return 0ll;
    if (n & 1) {
      return ((n+1)/2) & 1;
    } else {
      return (((n+1)/2) & 1) + n;
    }
  };
  ans = f (B) ^ f (A-1);
  printf("%lld\n", ans);
  return 0;
}

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

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

    ll n;
    cin >> n;
    vector<ll> l(n);
    for (ll i = 0;i < n;i++){
        cin >> l[i];
    }
    ll ans = 0;
    for (ll i = 0; i < n-2; i++){
        for (ll j = i+1; j < n-1; j++){
            for (ll k = j+1; k < n; k++){
                vector<ll> x(3);
                x[0] = l[i];
                x[1] = l[j];
                x[2] = l[k];
                sort(x.begin(), x.end());
                if (x[0] != x[1] && x[1] != x[2] && x[2] != x[0]){
                    if (x[0]+x[1] > x[2]){
                        ans++;
                    }
                }
               
            }

        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    int N;
    cin >> N;

    set<int> st;
    REP(i, N) {
       int tmp; cin >> tmp;
        st.insert(tmp);
    }

    cout << (((N - st.size()) % 2 == 0) ? st.size() : st.size() - 1) << endl;

    return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int64_t,int64_t> pll;
typedef vector<int64_t> vl;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
const long double PI = acos(-1);
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define ALL(a) begin(a),end(a)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
    int n;

void solve() 
{
    vector<vector<ll> >dp(10,vector<ll>(10,0));
cin>>n;
    REP(i,n+1){
        int last=i%10;
        int top=i;
        while(top/10)top/=10;
        dp[top][last]++;
    }
    ll ans=0;
    rep(i,1,10)rep(j,1,10){
        ans+=dp[i][j]*dp[j][i];
    }
    cout<<endl<<ans<<endl;
}
int main()
{
    cin.tie(0);
	ios::sync_with_stdio(false);
    solve();
    return 0;
}


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


int main() {

  int n;
  cin>>n;

  int t,a;
  cin>>t>>a;

  long double min_wk=10000000000;
  int point;
  for(int i=0;i<n;i++){
    int h;
    cin>>h;

    long double temp = abs(t-h*0.006-a);
  
    if(temp<min_wk)
    {
      min_wk=temp;
      point=i+1;
    }
  }

  cout<<point<<endl;

  return 0;
}




Measured memory_bytes: 3560
from fractions import gcd
N, M = map(int, input().split())
S = input()
T = input()
L = N*M//gcd(N,M)
a = L//N
b = L//M
c = a*b//gcd(a,b)
i = 0
while i<L:
  if S[i//(L//N)] != T[i//(L//M)]:
    print(-1)
    exit()
  i += c
print(L)

Measured memory_bytes: 5436
#include<bits/stdc++.h>
using namespace std;
int main(){
    string a;   
    bool v=0,t=0;
    cin>>a;
    for(int i=0;i<a.size();i++){
        if(a[i]=='C') 
            v=1; 
        if(a[i]=='F'&&v)  
            t=1; 
    }
    if(t) cout<<"Yes";
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#abc105c
import sys

n=int(raw_input())
if n==0:
 print 0
 sys.exit()
res=''
while n:
 if n%(-2)==0:
  res+='0'
 else:
  res+='1'
 n+=n%(-2)
 n/=(-2)
print res[::-1]


Measured memory_bytes: 2568
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <math.h>
#include <queue>
#include <unordered_map>
using namespace std;
typedef long long ll;
#define PI 3.14159265359

int main() {
  ll N;
  cin >> N;
  ll A;
  vector<ll> vec;
  ll limit = pow(10, 6);
  vec.reserve(limit);
  for (auto i = 0;i < limit;i ++) {
    vec.push_back(0);
  }
  ll ret = 0;
  for (auto i = 0;i < N;i ++) {
    cin >> A;
    vec[A] ++;
    ret += A;
  }
  ll Q, B, C;
  cin >> Q;
  for (auto i = 0;i < Q;i ++) {
    cin >> B >> C;
    ret += (C - B) * vec[B];
    vec[C] += vec[B];
    vec[B] = 0;
    cout << ret << endl;
  }
  return 0;
}

Measured memory_bytes: 11176
import java.util.*;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int ops = s.length() - 1;
        int ans = 0;
        for (int bit = 0; bit < (1 << ops); bit++) {
            int sum = Character.getNumericValue(s.charAt(0));
            for (int i = 0; i < ops; i++) {
                int next = Character.getNumericValue(s.charAt(i + 1));
//                debug(bit, sum ,next);
                if ((bit & (1 << i)) != 0) sum += next;
                else sum -= next;
            }
//            debug(bit, sum);
            if (sum == 7) {
                ans = bit;
                break;
            }
        }
        System.out.print(s.charAt(0));
        for (int i = 0; i < ops; i++) {
            System.out.print((ans & (1 << i)) != 0 ? "+" : "-");
            System.out.print(s.charAt(i + 1));
        }
        System.out.println("=7");
    }


    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

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

}


Measured memory_bytes: 21716
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>

//https://atcoder.jp/contests/abc121/tasks/abc121_b

int main()
{
    std::ios::sync_with_stdio(false); // toggler av synkronisjon mellom c og c++ data streams. kan ikke blade de etter skrudd av
    std::cin.tie(NULL);               //gj;r at man ikke venter på cout og de can printe samtidig tror jeg

    //linjen er opp til 100. det er en linje p[ lengde hundre med hus p[ bare de nevte stedene]]

    std::string a, b;
    std::cin >> a >> b;

    int num = std::stoi(a + b);

    for (int u = 1; u < 1100; u++)
    {
        if (u * u == num)
        {
            std::puts("Yes");
            return (0);
        }
    }

    std::cout << "No\n";
}


Measured memory_bytes: 3612