akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int   //used int to avoid mle
#define ulli unsigned long long int 
#define ld long double
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(lli i=a;i<b;i++)
#define initialize(array,size,value) for(lli i=0;i<size;i++) array[i]=value
#define couta(array,size) for(lli i=0;i<size;i++) cout<<array[i]<<" "
#define vl vector<lli>
#define vp vector< pair <lli,lli> >
#define sl set<lli>
#define spl set<pll>
#define msl multiset <lli>
#define msp multiset <pll>
#define pll pair<lli, lli>
#define mll map<lli, lli>              //for( map<lli, lli>::iterator i=temp.begin();i!=temp.end();i++)cout<<i->fi<<" "<<i->se<<endl;
#define mvl map<lli, vl>
#define umll unordered_map<lli, lli>
#define vt vector<pair<lli, pll >  >
#define vf vector<pair<pll,pll > >
#define qu queue<lli>
#define pq priority_queue<lli>
#define dq deque <lli>
#define ptr vector<lli>::iterator
#define bs(array,x) binary_search(array.begin(),array.end(),x)
#define lb(array,x) lower_bound(array.begin(),array.end(),x)
#define ub(array,x) upper_bound(array.begin(),array.end(),x)
#define nobw(array,i,j) upper_bound(array.begin(), array.end(), j)-lower_bound(array.begin(), array.end(), i) //number of numbers between i & j
#define vc clear()
#define endl '\n'
#define sp system("pause");
#define INF 9223372036854775807
#define MINF -9223372036854775808
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
lli mod=1000000007;

int main()
{
 	ios::sync_with_stdio(0);
    cin.tie(0);
   lli n,m;
    cin>>n>>m;
    if(n==m)cout<<"Yes";
    else cout<<"No";
   
}

Measured memory_bytes: 256
#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <map>
#include <queue>
#include <set>
#include <string.h>
#include <vector>

using namespace std;
typedef long long ll;

int main() {
  int N, K;
  cin >> N >> K;

  vector<ll> A;
  ll a;
  ll MOD = 1000000007;

  for (int i = 0; i < N; ++i) {
    cin >> a;
    A.push_back(a);
  }

  ll dp[N + 1][K + 1];
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;

  for (int i = 0; i < N; ++i) {
    ll sum = 0;
    ll a = A[i];

    for (int k = 0; k <= K; ++k) {
      sum += dp[i][k];

      int m = k - a - 1;

      if (m >= 0) {
        sum -= dp[i][m];
      }

      dp[i + 1][k] = sum % MOD;
    }
  }

  cout << dp[N][K] << endl;

  return 0;
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

LL n,a[2010],dp[2010][2010],b[2010],ans=0;

bool cmp(int x,int y)
{
	return a[x]>a[y];
}

int main()
{
	cin>>n;
	rep(i,n)
	{
		cin>>a[i];
		b[i]=i;
	}
	sort(b,b+n,cmp);
	rep(i,2005) rep(j,2005) dp[i][j]=-1;
	dp[0][n-1]=0;
	rep(len,n)
	{
		rep(i,len+1)
		{
			int j=n-(len-i)-1;
			if(i==j) ans=max(ans,dp[i][j]+a[b[len]]*abs(b[len]-i));
			else dp[i+1][j]=max(dp[i+1][j],dp[i][j]+a[b[len]]*abs(b[len]-i));
			if(i==j) ans=max(ans,dp[i][j]+a[b[len]]*abs(b[len]-j));
			else dp[i][j-1]=max(dp[i][j-1],dp[i][j]+a[b[len]]*abs(b[len]-j));
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 35144
use std::io::*;
use std::str::*;

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

pub fn main() {
    let stdin = stdin();
    let mut stdin = stdin.lock();
    let stdin = &mut stdin;

    let n: u32 = read(stdin).unwrap();
    let mut nums: [u32; 200] = [0; 200];
    for i in 0..n as usize {
        nums[i] = read(stdin).unwrap();
    }

    let mut count = 0;
    let mut nums = (&nums[0..n as usize]).to_vec();
    while nums.iter().all(|e| e % 2 == 0) {
        count += 1;
        nums = nums.iter().map(|e| (e - e % 2) / 2).collect::<Vec<_>>();
    }
    println!("{:?}", count);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define COUT(x) cout<<(x)<<endl
typedef long long ll;
template<class T> inline void chmax(T& a, T b) {
  if (a < b) a = b;
}

template<class T> inline void chmin(T& a, T b) {
  if (a > b) a = b;
}

const long long INF = 1LL << 60;
int main() {
  ll n,m;
  cin >> n >> m;
  int a[m];
  for (int i = 0; i < m; ++i) {
    cin >> a[i];
  }
  int res = -1;
  ll sum = 0;
  for (int i = 0; i < m; ++i) {
    sum += a[i];
  }
  if ( sum > n) COUT(res);
  else if(sum <= n) COUT(n - sum);
  return 0;

}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define LLI long long int
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define POS(i) cout<<(i?"POSSIBLE":"IMPOSSIBLE")<<endl
#define Pos(i) cout<<(i?"Possible":"Impossible")<<endl
#define co(i) cout<<i<<endl
using namespace std;
//
const int INF=1e9+7;
const int MOD=1e9+7;
//
int main(){
    int a,b; cin>>a>>b;
    cout<<(a<=8&&b<=8?"Yay!":":(")<<endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
 
namespace Template
{
    public class Scanner
    {
        public string NextLine => Console.ReadLine();
        public int NextInt => int.Parse(NextLine);
        public long NextLong => long.Parse(NextLine);
        public double NextDouble => double.Parse(NextLine);
 
        public string[] StrAry(char separator = ' ') => Console.ReadLine().Split(separator);
        public int[] IntAry(char separator = ' ') => Array.ConvertAll(StrAry(separator), int.Parse);
        public long[] LongAry(char separator = ' ') => Array.ConvertAll(StrAry(separator), long.Parse);
        public double[] DoubleAry(char separator = ' ') => Array.ConvertAll(StrAry(separator), double.Parse);
    }
 
    internal class Template
    {
        public static void Swap<T>(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }
        private static void Fill<T>(T[] src, T value, int len) { for (int i = 0; i < len; i++) { src[i] = value; } }
 
        static void Solve() 
        {
            var scan = new Scanner();
            var line = scan.IntAry();
            int A = line[0], B = line[1];
            if (A == 1 && B == 1) Console.WriteLine("Draw");
            else if (A == 1) Console.WriteLine("Alice");
            else if (B == 1) Console.WriteLine("Bob");
            else
            {
                if (A == B) Console.WriteLine("Draw");
                else if (A > B) Console.WriteLine("Alice");
                else Console.WriteLine("Bob");
            }
        }
 
        private static void Main()
        {
            Console.SetOut(new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
            Solve();
            Console.Out.Flush();
        }
    }
}


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

#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << '\n'
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 1e9+7;


signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;cin>>N;
  vll sum(N+1,0);
  for(ll i=0;i<N;i++){
    ll W;cin>>W;
    sum[i+1]=sum[i]+W;
  }
  ll ans = INF;
  for(ll i=0;i<=N;i++){
    ans = min(ans,abs(sum[N]-sum[i]-sum[i]));
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc056/tasks/abc056_b

#include <iostream>

using namespace std;

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

    // compare a+W, b
    // compare b+W, a
    int ret = 0;
    if (a+W <= b) {
        ret = b - (a+W);
    } else if (b+W <= a) {
        ret = a - (b+W);
    }
    cout << ret << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>
#include <iterator>
#include <regex>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(x,xs) for(auto &x: xs)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

template <class T, template <class, class> class C, class charT = char>
void vdump(const C<T, allocator<T>> &v, const charT* delimiter = ", ",
           ostream &stream = cout) {
  copy(v.begin(), v.end(), ostream_iterator<T>(stream, delimiter));
  stream << endl;
}

int main() {
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int w;
  cin >> w;
  string ans;
  for(int i=0; i<s.size(); i+=w) {
    ans.push_back(s[i]);
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long mod = 1e9 + 7;

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

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

int main() {
	int n;
	cin >> n;
	
	vector<int> vi(n);

	for (int i = 0; i < n; i++) {
		cin >> vi[i];
	}
	
	ll ans = 0;
	int cnt = 1;

	for (int i = 0; i < n; i++) {
		if (vi[i] == cnt) {
			ans++;
		} else if(i == n-1){
			break;
		} else {
			continue;
		}
		cnt++;
	}

	if (ans == 0) {
		cout << -1 << endl;
	} else {
		cout << n - ans << endl;
	}	
}


Measured memory_bytes: 1024
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

int main()
{
    ll H, W;
    cin >> H >> W;
    ll cnt = 0;
    rep(i, H) {
        string s;
        cin >> s;
        rep(j, W) {
            if (s[j] == '#') cnt++;
        }
    }
    if (cnt == H+W-1) print("Possible");
    else print("Impossible");
    return 0;
}


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



typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;
typedef vector< vector< vector<ll> > > vvvint;
typedef vector<string> vstring;
typedef vector< vector<string> > vvstring;
typedef vector<char> vchar;
typedef vector< vector<char> > vvchar;
typedef vector<long double> vdouble;
typedef vector< vector<long double> > vvdouble;
typedef vector< vector< vector<long double> > > vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;
typedef vector<bool> vbool;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define ALL(obj) (obj).begin(), (obj).end()
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())
#define MOD 1000000007
const double PI=3.14159265358979323846;

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







int main() {


  cout<<fixed<<setprecision(10);

  string s, t; cin>>s>>t;

  vvint dp(s.size()+1, vint(t.size()+1, 0));

  rep(i, s.size()){
    rep(j, t.size()){
      if(s[i] == t[j]){
        chmax(dp[i+1][j+1], max({dp[i][j+1], dp[i+1][j], dp[i][j]+1}));
      }else{
        chmax(dp[i+1][j+1], max(dp[i][j+1], dp[i+1][j]));
      }
    }
  }

  // rep(i,s.size()+1){
  //   rep(j, t.size()+1){
  //     cout<<dp[i][j]<<" ";
  //   }
  //   cout<<endl;
  // }

  string ans = "";
  ll i = s.size();
  ll j = t.size();
  ll cnt = dp[i][j];
  while(cnt > 0){
    // decrease i
    while(dp[i][j] == dp[i-1][j]) i--;
    while(dp[i][j] == dp[i][j-1]) j--;
    ans = s[i-1] + ans;
    i--; j--;
    cnt--;
  }

  cout<<ans<<endl;

}

//


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

  int main(){
    int a[5];
    int k;
    cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> k;
    sort(a,a+5);
    if (a[4]-a[0]<=k){
      cout << "Yay!" << endl;
    }
    else{
      cout << ":(" << endl;
    }
  }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll md=1e9+7;
ll pl(ll a,ll b){
	if(b==0)
	return 1;
	ll ans=1;
	for(int i=a;i>=a-b+1;i--)
	{
		ans*=i;
		ans%=md;
	}
	return ans;
}
int main(){
ll a,b;
cin>>a>>b;
ll mx,mi;
mx=max(a,b);
mi=min(a,b);
if(mi<mx-1)
{
	cout<<0<<endl;

}
else{
	ll ans=pl(mx,mx);
	ans*=pl(mi,mx-1);
	ans%=md;
	ans*=pl(2,mi-(mx-1));
	ans%=md;
	cout<<ans<<endl;
}
	return 0;
} 

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <queue>
#include <algorithm>
#include <iostream>
#include <vector>
#include <unordered_map>
//#include <bits/stdc++.h>
#include <cassert>
#include <map>
#include <bitset>
using namespace std;

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;

const int N = 8e3+1;
const int maxn = N<<1;

char ss[maxn];
int d[2] = {0};
bitset<maxn> dp[2];
int x, y;

int main()
{
    scanf("%s %d %d", ss, &x, &y);
    char *s = ss;
    dp[0].reset();
    dp[1].reset();
    dp[0][N] = 1;
    dp[1][N] = 1;
    int dir = 0;
    int sum = 0;
    while (*s == 'F')
    {
        ++sum;
        ++s;
    }
    dp[dir] = (dp[dir]<<sum);
    
    while (*s)
    {
        if (*s == 'T')
        {
            dp[dir] = (dp[dir]<<d[dir]) | (dp[dir]>>d[dir]);
            d[dir] = 0;
            dir ^= 1;
        }
        else
            d[dir] += 1;
        ++s;
    }
    dp[dir] = (dp[dir]<<d[dir]) | (dp[dir]>>d[dir]);

    
    if (dp[0][x+N] == 1 && dp[1][y+N] == 1)
        puts("Yes");
    else
        puts("No");
    
}



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

using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 5e5 + 10;
const ll INF = 1LL << 60;

template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}



// Main Code
int ans[55][55];

int main()
{
  int n, m;
  cin>>n>>m;
  string s[n+1];
  repn(i, 1, n)
    cin>>s[i];
  repn(i, 1, n)
    rep(j, 0, m)
    {
      if(s[i][j] == '#')
      {
        rep(k , -1, 2)
          rep(l, -1, 2)
          {
            ans[i-k][j-l+1]++;
          }
      }
    }
  repn(i, 1, n)
  {
    rep(j, 0, m)
    {
      if(s[i][j] == '.')
      {
        cout<<ans[i][j+1];
      }
      else cout<<"#";
    }
    cout<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n;
  cin >> n;
  if(n==1){
    cout << "Hello World" << endl;
  }else{
    int a,b;
    cin >> a >> b;
    cout << a+b << endl;
  }
}


Measured memory_bytes: 256
import numpy as np
N,K = map(int,input().split(' '))
h = []
for i in [0]*N:
	h.append(int(input()))


def sort(l):
	m = sum(l)/len(l)
	a = [x for x in l if x < m]
	b = [x for x in l if m <= x]
	if a == []:
		return b
	if b == []:
		return a
	return sort(a)+sort(b)

h = np.array(h)
sh = np.sort(h)
#sh = sort(h)
ans = max(h)
for i in range(0,N-K+1):
	s = (sh[i+K-1] - sh[i])
	if s < ans:
		ans = s
print(ans)



Measured memory_bytes: 20860
import java.util.*;

public class Main{
  static int p = 1000000007;
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String[] S = sc.nextLine().split(" ");
    int[][] bingo = new int[3][3];
    bingo[0][0] = Integer.parseInt(S[0]);
    bingo[0][1] = Integer.parseInt(S[1]);
    bingo[0][2] = Integer.parseInt(S[2]);
    
    S = sc.nextLine().split(" ");
    bingo[1][0] = Integer.parseInt(S[0]);
    bingo[1][1] = Integer.parseInt(S[1]);
    bingo[1][2] = Integer.parseInt(S[2]);
    
    S = sc.nextLine().split(" ");
    bingo[2][0] = Integer.parseInt(S[0]);
    bingo[2][1] = Integer.parseInt(S[1]);
    bingo[2][2] = Integer.parseInt(S[2]);
    
    boolean[][] check = new boolean[3][3];
    
    int N = sc.nextInt();
    for(int i = 0; i < N; i++){
      int M = sc.nextInt();
      for(int j = 0; j<3; j++){
        for(int k = 0; k < 3; k++){
          if(bingo[j][k] == M){
            check[j][k] = true;
          }
        }
      }
    }
    boolean c1 = check[0][0] && check[0][1] && check[0][2];
    boolean c2 = check[1][0] && check[1][1] && check[1][2];
    boolean c3 = check[2][0] && check[2][1] && check[2][2];
    boolean c4 = check[0][0] && check[1][0] && check[2][0];
    boolean c5 = check[0][1] && check[1][1] && check[2][1];
    boolean c6 = check[0][2] && check[1][2] && check[2][2];
    boolean c7 = check[0][0] && check[1][1] && check[2][2];
    boolean c8 = check[0][2] && check[1][1] && check[2][0];
    System.out.println(c1 || c2 || c3 || c4 || c5 || c6 || c7 || c8 ? "Yes" : "No");
  }
}

Measured memory_bytes: 22608
s = input()
n = int(input())

s_array = []
for i in range(len(s)):
    s_array.append(s[i])

for i in range(n):
    order = input().split()
    if order[0] == "replace":
        first = int(order[1])
        last = int(order[2])
        for j in range(last-first+1):
            s_array[first+j] = order[3][j]
    elif order[0] == "reverse":
        a = int(order[1])
        b = int(order[2])
        buf = []
        for j in range(b, a-1, -1):
            buf.append(s_array[j])
        for j in range(b+1-a):
            s_array[a+j] = buf[j]
    elif order[0] == "print":
        a = int(order[1])
        b = int(order[2])
        for j in range(a, b+1):
            print("%s" % s_array[j], end="")
        print()
    



Measured memory_bytes: 5744
N = input()
A = map(int, raw_input().split())

M = {}
for a in A:
  if a not in M:
    M[a] = 0
  M[a] += 1

V = [0, 0]
for a in M:
  if M[a]>=4:
    V += [a, a]
  elif M[a]>=2:
    V += [a]
V.sort()
print V[-1]*V[-2]


Measured memory_bytes: 16088
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
using namespace std;
typedef long long ll;

int main()
{
  int N;
  int a[110000];
  int res=0;
  cin >> N;

  rep(i,N) cin >> a[i];

  rep(i,N){
    while(a[i]%2==0) {
      res++;
      a[i] /= 2;
    }
  }

  cout << res << endl;
}

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

typedef long long ll;

const int N = 105, V = 100005;

ll dp[V];
ll value[N];
ll weight[N];
int object_count, max_weight;

void solve() {
    for (int i = 1; i <= object_count; ++i) {
        for (int w = max_weight; ~w; --w) {
            if (w >= weight[i]) {
                dp[w] = max(dp[w], dp[w - weight[i]] + value[i]);
            } else {
                dp[w] = dp[w];
            }
        }
    }
}

void debug() {
    for (int w = 1; w <= max_weight; ++w) {
        printf("%18lld", dp[w]);
    }
}

int main() {
    scanf("%d%d", &object_count, &max_weight);
    for (int i = 1; i <= object_count; ++i) {
        scanf("%lld%lld", weight + i, value + i);
    }
    solve();
    printf("%lld\n", dp[max_weight]);
    return 0;
}

Measured memory_bytes: 896
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0; i<n; i++)
#define rep2(i,a,b) for(ll i=a; i<=b; i++)
#define drep2(i,a,b) for(ll i=a; i>=b; i--)

bool test(vector<string> s, int h, int w) 
{
  bool u = s[h-1][w] == '#';
  bool d = s[h+1][w] == '#';
  bool l = s[h][w-1] == '#';
  bool r = s[h][w+1] == '#';

  return u || d || l || r;
  
}

int main ()
{
  int h, w;
  cin >> h >> w;
  vector<string> s(h+2);

  rep(i,w+2)
    s[0] += "x" ;

  rep2(i,1,h) {
    string tmp;
    s[i] = "x";
    cin >> tmp;
    s[i] += tmp;
    s[i] += "x";
  }

  rep(i,w+2)
    s[h+1] += "x" ;

  rep2(i,1,h) {
    rep2(j, 1, w) {
      if (s[i][j] == '#') {
        if (!test(s, i, j)) {
          cout << "No" << endl;
          return 0;
        }
          
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
//  rep(i,h+2) {
//    cout << "test: " << i << " " << s[i] << endl;
//  }
  
}

Measured memory_bytes: 256
from collections import  deque
import sys
import bisect
# import math
import itertools
from queue import deque
# from math import gcd

INF = float('inf')
mod = 10**9+7
eps = 10**-7

def inp(): return int(sys.stdin.readline())
 
def inp_list(): return list(map(int, sys.stdin.readline().split()))

# def lcm(x, y): return (x * y) // gcd(x, y)

N = inp()
A = [0 for _ in range(N)]
xx = [[] for _ in range(N)]
yy = [[] for _ in range(N)]

for i in range(N):
    A[i] = inp()
    for _ in range(A[i]):
        x, y = inp_list()
        xx[i].append(x)
        yy[i].append(y)

# ↑ inputs
# ↓ main process

# {0, 1, ..., N-1} の集合の bit 全探索
ans = 0
for bit in range(1 << N):
    """
        例： bit == 10 のとき、2進数では 001010 
            右から人 1, 2, ..., 6 と対応させる。
    """
    is_inconsistent = False
    # 整数 bit を２進数表示し、右から 1/0 を True/False に置換
    is_honest = [(bit >> i) & 1 for i in range(N)]
    for i in range(N):
        if not is_honest[i]: continue
        for (x, y) in zip(xx[i], yy[i]):
            if is_honest[x - 1] != y:
                is_inconsistent = True # 矛盾
    if not is_inconsistent:
        ans = max(ans, sum(is_honest))
print(ans)


Measured memory_bytes: 44248
using AtCoderBeginnerContest141.Questions;
using AtCoderBeginnerContest141.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtCoderBeginnerContest141.Questions
{
    public class QuestionA : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var s = inputStream.ReadLine();

            switch (s)
            {
                case "Sunny":
                    yield return "Cloudy";
                    yield break;
                case "Cloudy":
                    yield return "Rainy";
                    yield break;
                case "Rainy":
                    yield return "Sunny";
                    yield break;
            }
        }
    }
}


namespace AtCoderBeginnerContest141
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionA();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace AtCoderBeginnerContest141.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace AtCoderBeginnerContest141.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

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

ll dp[100005];
int w[105], v[105];

int main() {
  int n, W;
  cin >> n >> W;
  for (int i = 1; i <= n; i++)
    dp[i] = -0x3f3f3f3f3f3f3f3fll;
  for (int i = 0; i < n; i++)
    cin >> w[i] >> v[i];
  for (int j = 0; j < n; j++)
    for (int i = W; i >= 0; i--)
      if (i - w[j] >= 0)
        dp[i] = max(dp[i], dp[i - w[j]] + v[j]);
  cout << *max_element(dp, dp + W + 1) << endl;
}

Measured memory_bytes: 1024
S = input()
K = int(input())

Count = []
c = []
pre = ''
for s in S:
  if s != pre:
    if len(c) != 0:
      Count.append(c)
    c = [s,1]
    pre = s
  else:
    c[1] += 1
if len(c) != 0:
  Count.append(c)
#print(Count)
if len(Count) == 1:
  ans = Count[0][1]*K//2
else:
  ans = 0
  for i in range(len(Count)):
    ans += Count[i][1]//2
  ans *= K
  if Count[0][0] == Count[-1][0] and Count[0][1] % 2 == 1 and Count[-1][1] % 2 == 1:
    ans += K-1
print(ans)  


Measured memory_bytes: 38484
# coding: utf-8
# Your code here!


import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline 

from itertools import accumulate

n = int(input())
#a = [int(i) for i in readline().split()]


for i in range(1,10):
    for j in range(1,10):
        if i*j == n:
            print("Yes")
            exit()

print("No")









Measured memory_bytes: 3060
#include <iostream>
#include <cstring>
#include <cstdlib>
using namespace std;

int top[100][100];
int h[100][100];
int Rotation[4][6]={
	{5,1,4,3,0,2}, //南
	{0,5,2,4,1,3}, //東
	{4,1,5,3,2,0}, //北
	{0,4,2,5,3,1}  //西
};
struct P{int x,y;} d[4]={
{0,-1}, //南
{1,0},  //東
{0,1},  //北
{-1,0}  //西
};

main(){
	int i,j,n,t,f,x,y;
	while(cin>>n,n){
		memset(top, 0, sizeof(top));
		memset(h, 0, sizeof(h));
		while(n--){
			cin >> t >> f;
			int tD[6], D[6]={3,5,4,2,1,6};
			while(D[4] != t || D[0] != f){
				memcpy(tD, D, sizeof(D));
				int r = rand()%4;
				for(i=0;i<6;i++) D[Rotation[r][i]] = tD[i];
			}
			x = 50;
			y = 50;
			while(h[x][y] != 0){
				int dt = -1;
				for(j=6;j>3;j--){
					for(i=0;i<4;i++) if(D[i]==j)break;
					if(i>=4 || h[x+d[i].x][y+d[i].y] >= h[x][y]) continue;
					dt = i;
					break;
				}
				if(dt<0) break;
				x += d[dt].x;
				y += d[dt].y;
				memcpy(tD, D, sizeof(D));
				for(i=0;i<6;i++) D[Rotation[dt][i]] = tD[i];
			}
			h[x][y] ++;
			top[x][y] = D[4];
		}
		int sum[7]={0};
		for(i=0;i<100;i++)
		for(j=0;j<100;j++)
			sum[top[i][j]] ++;
		cout<<sum[1]<<' '<<sum[2]<<' '<<sum[3]<<' '<<sum[4]<<' '<<sum[5]<<' '<<sum[6]<<endl;
	}
	
	return 0;
}

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

int main(void){
  
  int n;
  int  count = 1;

  while(1){
    cin >> n;
    if(n == 0)
      break;
    
    cout << "Case " << count << ": " << n << endl;
    count++;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
#define FAST_IO                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define watch(x) cout << (#x) << " is: " << (x) << endl
#define vw(v)                        \
    cout << (#v) << " is: " << endl; \
    for (long long B : (v))                \
    {                                \
        cout << B << " ";            \
    }                                \
    cout << endl
#define check(x) cout << "here " << (x) << "?" << endl
#define rep(i, a, b) for (long long i = (a); i < (b); i++)
#define per(i, a) for (long long i = (a - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rv(x) (x).rbegin(), (x).rend()
#define pb push_back
long long const MAX = 2147483647, REALMAX = 9223372036854775806;
int main()
{
	FAST_IO
		long long a, b , sum = 0 , k = 1;
	cin >> a >> b;
	while (k < b) {
		k += a - 1;
		sum++;
	}
	cout << sum;

}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
#define yorn(f) puts((f)?"Yes":"No")
ll a,b,m;
//ld ;
//string s;
 
int main() {
  cin >> a >> b >> m;
  ll aMin = 1000000;
  ll bMin = 1000000;
  ll cMin = 1000000;
  ll aSer[a];
  ll bSer[b];
  for(ll ia=0;ia<a;ia++){
    ll aTemp;
    cin >> aTemp;
    aSer[ia] = aTemp;
    aMin = (aTemp<aMin)?aTemp:aMin;
  }
  for(ll ib=0;ib<b;ib++){
    ll bTemp;
    cin >> bTemp;
    bSer[ib] = bTemp;
    bMin = (bTemp<bMin)?bTemp:bMin;
  }
  cMin = aMin + bMin;
  for(ll i=0;i<m;i++){
    ll x,y,c;
    cin >> x >> y >> c;
    ll cTemp = aSer[x-1] + bSer[y-1] - c;
    cMin = (cTemp<cMin)?cTemp:cMin;
  }
  cout << cMin << endl;
  return 0;
}

Measured memory_bytes: 1792
//{{{
#include <bits/stdc++.h>
using namespace std;
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop,~))(__VA_ARGS__)
#define loop(n) rep2(_loop_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define repN(a) repX a
#define repX(a0,a1,a2,x,...) x
#define foreach(x,a) for(auto &x:a)
typedef long long ll;
const int MOD = 1e9+7;
//}}}

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  puts((a + b >= c) ? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define MOD 1000000007
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define int long long
#define ALL(A) A.begin(),A.end()
using vi=vector<int>;
using vii=vector<vi>;
signed main(){
  int N,sum=0;
  cin>>N;
  vi H(N);
  rep(i,0,N){
    cin>>H[i];
    sum=max(H[i],sum);
  }
  int ans=0;
  REP(i,1,sum){
    bool flag=0;
    rep(j,0,N){
      if(H[j]>=i) flag=1;
      else{
        if(flag) ans++;
        flag=0;
        }
      }
    if(flag) ans++;
    }
  cout<<ans<<endl;
}

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

//Containers
typedef long long int lng;
#define vint vector<int>
#define vtwod vector<vector<int>>
#define vlng vector<long long int>
#define vstr vector<string>
#define vvint vector<int,int>
#define pint pair<int,int>
#define lint list<int>
#define qint queue<int>
#define dqint deque<int>
#define pq priority_queue<int>
#define rpq priority_queue<int,vector<int>,greater<int>>
#define fl forward_list<int>
#define st stack<int>
#define sint set<int>
#define msint multiset<int>


//Methods of containers:-
#define pb push_back
#define pf push_front
#define mp make_pair
#define F first
#define S second
#define ub upper_bound
#define lb lower_bound
#define binsear binary_search
#define popf pop_front
#define popb pop_back
#define empb emplace_back
#define empf emplace_front
#define emp emplace
#define emt empty
#define ins insert
#define insaft insert_after
#define emplaft emplace_after
#define ersaft erase_after
#define swp swap
#define splicaft splice_after


//FUNCTIONS
int min3(int a,int b,int c)
{
    return min(min(a,b),c);
}
int max3(int a,int b,int c)
{
    return max(max(a,b),c);
}
void gcd(int a,int b)
{
    cout<<__gcd(a,b)<<endl;
}

/*******************************************************************CODE**************************************************************/
void doit()
{
    int a[5],key=0;;
    for(size_t i=0;i<5;i++)
    {
        cin>>a[i];
        if(a[i]==0)
        {
            key=i;
        }
    }
    cout<<key+1<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(NULL);
    doit();
    return 0;
}



Measured memory_bytes: 3632
import fractions

A, B, C, D = [int(i) for i in input().split()]

lcm_CD = (C*D)//fractions.gcd(C, D)

C_bot = C * -(-A//C) 
C_top = C * (B//C) 
D_bot = D * -(-A//D)
D_top = D * (B//D)
CD_bot = lcm_CD * -(-A//(lcm_CD ))
CD_top = lcm_CD  * (B//(lcm_CD ))

num_A_B = B - A + 1
num_divC = (C_top - C_bot)//C + 1
num_divD = (D_top - D_bot)//D + 1
num_divCD = (CD_top - CD_bot)//(lcm_CD ) + 1
ans = num_A_B - num_divC - num_divD + num_divCD


print(int(ans))

Measured memory_bytes: 5076
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <array>
#include <random>
#include <complex>
#include <regex>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define fcout cout << fixed << setprecision(10)
#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define all(x) x.begin(), x.end()
#define F first
#define S second
const ll inf = 1e18;
const ll mod = 1e9 + 7;

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

// mod.m での a の逆元 a^(-1) を計算する。
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while(b){
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll modpow(ll a, ll n){
    ll res = 1;
    while(n>0){
        if(n&1){
            res = res * a % mod;
        }
        a = a * a % mod;
        n >>=1;
    }
    return res;
}


int main(){
    int n;
    cin >> n;
    int ans=0;
    rep(i,n){
        int tmp;
        cin >> tmp;
        if(i%2==0 && tmp%2==1) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3632
/*
 * 17-04-08_ARC071_D.cpp
 *
 *  Created on: 2017/04/08
 *      Author: ryoma
 */

#include<iostream>
#include<algorithm>

using namespace std;

typedef long long ll;

const int MOD = 1e9 + 7;

ll n, m;
ll x[100010], y[100010];

long long Sx, Sy;

ll mod_pow(int x, int n) {
	if (!n)
		return 1;
	ll res = mod_pow(x * x % MOD, n / 2);
	if (n & 1)
		res *= x % MOD;
	return res;
}

int main() {
	cin >> n >> m;
	for (int i = 1; i <= n; i++)
		cin >> x[i];
	for (int i = 1; i <= m; i++)
		cin >> y[i];
	/*	for (int i = 1; i < n; i++) {
	 for (int j = i + 1; j <= n; j++) {
	 Sx = (Sx + (x[j] - x[i]) % MOD) % MOD;
	 }
	 }
	 for (int i = 1; i < m; i++) {
	 for (int j = i + 1; j <= m; j++) {
	 Sy = (Sy + (y[j] - y[i]) % MOD) % MOD;
	 }
	 }
	 */
	for (int i = 1; i <= n / 2; i++) {
		Sx = (Sx + (n + 1 - 2 * i) % MOD * ((x[n + 1 - i] - x[i]) % MOD) % MOD)
				% MOD;
	}

	for (int i = 1; i <= m / 2; i++) {
		Sy = (Sy + (m + 1 - 2 * i) % MOD * ((y[m + 1 - i] - y[i]) % MOD) % MOD)
				% MOD;
		//cout << Sy << endl;
	}
	cout << Sx * Sy % MOD << endl;
	return 0;
}



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

int main(){
  vector<int> a(1000001);
  cin >> a.at(0);
  int ans=0;
  for(int i=1; i<1000001; i++){
    if(a.at(i-1)%2==0) a.at(i)=a.at(i-1)/2;
    else a.at(i)=a.at(i-1)*3+1;
    for(int j=0; j<i; j++){
      if(a.at(j)==a.at(i)){
        ans=i+1;
        break;
      }
    }
    if(ans!=0){
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
#define rep(i,n) for (int64_t i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    int n; cin>>n;
    vector<int> p(n);
    rep(i,n) cin>>p[i];
    sort(btoe(p));
    cout<<p[n-1]-p[0]<<endl;
    return 0;
}

Measured memory_bytes: 256
hwk = input().split()
h, w, k = int(hwk[0]), int(hwk[1]), int(hwk[2])
field = []
for i in range(h):
    row = input()
    field.append([1 if c == '#' else 0 for c in row])
    # field.append(row)
count = 0


def test(i, j):
    _sum = 0
    for r in range(h):
        if r in i: continue
        for c in range(w):
            if c in j: continue
            _sum += field[r][c]
            if _sum > k: return False
    return _sum == k


def subset(n):
    res = []
    i = 0
    while True:
        num_s = bin(i)[2:].zfill(n)
        tmp = []
        flag = True
        for idx in range(n):
            if num_s[idx] == '1':
                tmp.append(idx)
            else:
                flag = False
        res.append(tmp)
        i += 1
        if flag:
            break
    return res


row_idxs = subset(h)
col_idxs = subset(w)

for r_i in row_idxs:
    for c_j in col_idxs:
        if test(r_i, c_j):
            count += 1

print(count)


Measured memory_bytes: 9148
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<string>
#include<set>
#include<vector>
using namespace std;

int solve(){
  int miss[3] = { 0, 0, 0};
  for(int i=0; i<2; i++){
    int a;  cin >> a;
    a--;
    miss[a]=1;
  }
  for(int i=0; i<3; i++)  if(miss[i]==0){
    cout << i+1 << endl;
    return 0;
  }
}

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


Measured memory_bytes: 256
#include"stdio.h"
#include"math.h"



int main() {
	long int a, b, ans;
	scanf("%ld %ld", &a, &b);
	int waru, warareru;
	if (a >= b) { warareru = a;waru = b; }
	else {warareru = b;waru = a;}

	int r = warareru % waru;
	while (r != 0) {
		warareru = waru;
		waru = r;
		r = warareru % waru;
	}

	ans = waru;
	printf("%ld",a*b/ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, k;
    cin >> n >> k; short arr[k];
    for (int i = 0; i < k; i++)
        cin >> arr[i];
    while(true){
        bool f = 1;
        int y = n;
        while(y > 0){
            for (int i = 0; i < k; i++){
                if (y % 10 == arr[i]){
                    f = 0;
                    break;
                }
            }
            y /= 10;
        }
        if (f){
            cout << n << '\n';
            return 0;
        }
        ++n;
    }
    return 0;
}


Measured memory_bytes: 256
using System;

class Program
{
    static void Main(string[] args)
    {
        var abc = Console.ReadLine().Split(' ');
        var a = int.Parse(abc[0]);
        var b = int.Parse(abc[1]);
        var c = int.Parse(abc[2]);
        Console.WriteLine(a * b / 2);
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;

#define MAX_N (1<<18) //260000
template<typename T>
struct segtree{
    int n;
    T dat[2*MAX_N-1];

    void init(int n_){
        n = 1;
        while(n < n_) n *= 2;
        for(int i = 0; i < 2*n-1; i++) dat[i] = pi(inf,inf);
    }

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

    //(a,b,0,0,seg.n)で呼ぶ
    T query(int a, int b, int k, int l, int r){
        if(r <= a || b <= l) return pi(inf,inf);
        if(a <= l && r <= b) return dat[k];
        else{
            T vl = query(a,b,k*2+1,l,(l+r)/2);
            T vr = query(a,b,k*2+2,(l+r)/2,r);
            return min(vl, vr);
        }
    }
};

int n;
int a[200000];
ll ans = 0;
segtree<pi> seg;

void solve (int st, int en) {
    if (st == en) return;
    pi p = seg.query(st, en, 0, 0, seg.n);
    ans += p.first * (ll)(p.second-st+1) * (ll)(en-p.second);
    solve(st, p.second); solve(p.second+1,en);
}

int main() {
    cin >> n;
    seg.init(n);
    rep(i,n) cin >> a[i];
    rep(i,n) seg.update(i, pi(a[i],i));
    solve(0, n);
    cout << ans << endl;
}


Measured memory_bytes: 61312
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys
import math

a, b, c = map(float, sys.stdin.readline().split())
degree = abs(180-abs(c))*math.pi / 180

height = abs(b * math.sin(degree))
pos_x = b * math.cos(degree) + a
edge_x = (height**2 + pos_x**2) ** 0.5

print(round(a * height / 2, 6))
print(round(a + b + edge_x, 6))
print(round(height, 6))



Measured memory_bytes: 5700
#135
N=int(input())
p=list(map(int,input().split()))
a=p[:]
p_u=[x for x in range(1,N+1)]

if p==p_u:
    print("YES")
else:
    for i in range(N):
        if p[i]-p_u[i]>0:
            a[p[i]-1]=p[i]
            a[i]=p[p[i]-1]
            if a==p_u:
                print("YES")
            else:
                print("NO")
                break


Measured memory_bytes: 3060
class OneWayNode { // ??????????????????????????????
    OneWayNode n;
	string name;
	int restTime;
	
	public OneWayNode(string n, int t) {
		name = n;
		restTime = t;
	}
	
	public int time {
		get {return restTime;}
		set { restTime = value;}
	}
	public string job {
		get {return name;}
	}
	public OneWayNode next {
		get {return n;}
		set {n = value;}
	}
	
	public bool isFinish() {
		if (restTime <= 0) {
			return true;
		}
		return false;
	}
};

class Queue {
	private static void run(OneWayNode initNode, int quantum) {
		string lastExecJob = initNode.job; // ?????????????????¢??????????????????job????????????
		int pastTime = 0; // ????????????
		
		OneWayNode prevIncompNode = initNode; //?¨?????????§??????????§??????????????????????????????£????????§???????????£????????????????????????????????£????????????
		for (OneWayNode node = initNode; !((lastExecJob == node.job) && node.isFinish()); node = node.next) {// ????????£??????job?????¨??????????????????
			lastExecJob = node.job; // ?¨????: ???????????¨?????????job?????´??°??????????????????????????????????????????????????????????????£???????????????
			if (node.isFinish()) { // ??????????????£??????
				continue;// ????????????????????¨????????????????????????????§???????
			}
			if (node.time <= quantum) { // ????????¨??§??????????????????
				pastTime += node.time; // ???????????????????????????
				System.Console.WriteLine("{0} {1}", node.job, pastTime);
				prevIncompNode.next = node.next; // ?¨???????????????£???job?????????????????????????????????
			}
			else { // ???????????????????????£???
				pastTime += quantum; // ??¨????????????????????????
				prevIncompNode = node; // ????????????????????????????????´??°
			}
			node.time -= quantum; // ???????????????????????????
		}
	}
	
	
	public static void Main() {
		// ---------------- ??\??? ----------------
		string[] input = System.Console.ReadLine().Split(' ');
		int jobCount = int.Parse(input[0]);
		int quantum  = int.Parse(input[1]);
		
		string[] initJobInputStr = System.Console.ReadLine().Split(' ');
		int initJobAmount = int.Parse(initJobInputStr[1]);
		OneWayNode initNode = new OneWayNode(initJobInputStr[0], initJobAmount);
		OneWayNode prevNode = initNode;
		for (int i = 1; i < jobCount; ++i) { // ??\?????¨???????????????????§??????????
			string[] jobInputStr = System.Console.ReadLine().Split(' ');
			int jobAmount = int.Parse(jobInputStr[1]);
			OneWayNode node = new OneWayNode(jobInputStr[0], jobAmount);
			prevNode.next = node;
			prevNode = node;
		}
		prevNode.next = initNode; // ?????°????????????
		// ---------------- ??\???????????? ----------------
		
		run(initNode, quantum); // JOB????§?
	}
}

Measured memory_bytes: 16116