akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

class Timer {
    clock_t start;
    string name;
public:
    Timer() {name = "";start = clock();}
    Timer(string s){name = s;start = clock();}
    ~Timer() {fprintf(stderr, "%s: %.3gs\n", name.c_str(), 1.0*(clock() - start) / CLOCKS_PER_SEC);}
};

#define sq(a) ((a) * (a))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define what_is(x) cerr << fixed << setprecision(2) << boolalpha << #x << " = " << x << endl
#define setbitj(n, j) (n |= (1 << (j)))
#define isbitjOn(n, j) (((n & (1 << (j))) > 0) ? 1 : 0)
#define safeMod(a, m) ((((a)%(m))+(m))%(m))/*handling negative sign of remainder*/

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;

const double EPS = 1e-9;
const int INF = 0x7fffffff;
const double PI = acos(-1.0);
const int MAX = 100005;
const int MOD = 1000000007;
const int precision = 10;

inline bool isEq(double a, double b){return abs(a - b) < EPS;}
inline bool isEq(double a, double b, double eps){return abs(a - b) < eps;}
inline double toRad(double deg){return deg*PI/180;}
inline double toDeg(double rad){return rad*180/PI;}

//#define isValid(a, b) (a >= 0 && a < b)
//int dr[]  =  {0, -1, -1, -1,  0,  1, 1, 1};
//int dc[]  =  {1,  1,  0, -1, -1, -1, 0, 1};
vector<string>grid;
int main(int argc, char* argv[])
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    //cout << fixed << setprecision(precision);
    int h, w;
    cin >> h >> w;
    grid.resize(h);
    for(int i = 0; i < h; i++)
        cin >> grid[i];
    bool hig[105] = {};
    bool wig[105]  ={};
    for(int i = 0; i < h; i++){
        bool f = true;
        for(int j = 0; j < w && f; j++)
            f = grid[i][j] == '.';
        if(f)
            hig[i] = 1;
    }
    for(int i = 0; i < w; i++){
        bool f = true;
        for(int j = 0; j < h && f; j++)
            f = grid[j][i] == '.';
        if(f)
            wig[i] = 1;
    }
    for(int i = 0; i < h; i++){
        if(!hig[i]){
            for(int j = 0; j < w; j++){
                if(!wig[j])
                    cout << grid[i][j];
            }
            cout << endl;
        }
    }
    return 0;
}


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

int main() {
  string s;
  cin>>s;
  string ans="No";
  for(int i=0;i<=1;i++){
    if(s[i]!=s[i+1]){
      ans="Yes";
      break;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 384
from collections import defaultdict
H,W,N=map(int,input().split())
d=defaultdict(int)
for n in range(N):
  y,x=map(int,input().split())
  for i in range(3):
    for j in range(3):
      if W-3>=x+i-3>=0 and H-3>=y+j-3>=0:
        d[(x+i-3,y+j-3)]+=1
ans=[0]*10
S=0
for t,t_num in d.items():
  ans[t_num]+=1
  S+=1
ans[0]=(H-2)*(W-2)-S
for i in range(10):
  print(ans[i])


Measured memory_bytes: 181464
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
 
using namespace std;
using ll = long long;
int main(void){
 
 
  int n;
  cin>>n;
	vector<ll> a(n + 1), b(n);
  for(int i=0;i<n+1;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){
    cin>>b[i];
  }
  ll ans=0;
  ll m=0;
  
  for(int i=0;i<n;i++){
    m=min(a[i],b[i]);
    ans+=m;
    a[i]-=m;
    b[i]-=m;
    m=min(a[i+1],b[i]);
    ans+=m;
    a[i+1]-=m;
    b[i]-=m;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main() {
    string s, t;
    cin >> s >> t;
    int n = s.length(), m = t.length();
    vector <vector <int> > dp(n + 1, vector <int> (m + 1, 0));
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (s[i - 1] == t[j - 1]) {
                dp[i][j] = dp[i - 1][j - 1] + 1;
            }
            else {
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
            }
        }
    }
    string u;

    int i = n, j = m;
    while (i > 0 && j > 0) {
        if (s[i - 1] == t[j - 1]) {
            u.push_back(s[i - 1]);
            i--;
            j--;
        }
        else {
            if (dp[i - 1][j] > dp[i][j - 1]) {
                i--;
            }
            else {
                j--;
            }
        }
    }

    for (auto it = u.rbegin(); it != u.rend(); it++) {
        cout << *it;
    }
    cout << '\n';
    return 0;
}

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

int main(){
  long long N,x;
  cin>>N>>x;
  vector<long long> a(N);
  for(int i=0;i<N;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  int sum=0;
  int i;
  for(i=0;i<N;i++){
    if(sum+a[i]>x){
      cout<<i<<endl;
      return 0;
    }
    if(sum+a[i]==x){
      cout<<i+1<<endl;
      return 0;
    }
    sum=sum+a[i];
  }
  cout<<i-1<<endl;
  return 0;
}

    
    
    
  

Measured memory_bytes: 256
n = int(input())
abc = [list(map(int, input().split())) for i in range(n)]
dp = [[0,0,0] for i in range(n+1)]
for i,(a,b,c) in enumerate(abc):
  dp[i+1][0] = max(dp[i+1][0], max(dp[i][1],dp[i][2]) + a)
  dp[i+1][1] = max(dp[i+1][1], max(dp[i][2],dp[i][0]) + b)
  dp[i+1][2] = max(dp[i+1][2], max(dp[i][0],dp[i][1]) + c)
print(max(dp[n]))

Measured memory_bytes: 76248
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  int k[20],s[20][20],p[20];
  for(int i=0;i<m;i++){
    cin>>k[i];
    for(int j=0;j<k[i];j++){
      cin>>s[i][j];
    }
  }
  for(int i=0;i<m;i++) cin>>p[i];

  int ans=0;
  for(int bit=0;bit<(1<<n);bit++){
    int light=0;
    for(int i=0;i<m;i++){
      int cnt=0;
      for(int j=0;j<k[i];j++){
        if(bit & (1<<s[i][j]-1)) cnt++;
      }
      if(p[i]==0 && (cnt%2==0)) light++;
      if(p[i]==1 && (cnt%2!=0)) light++;
    }
    if(light==m) ans++;
   }

   cout<<ans;


  }


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

struct Scanner<'a> {
    cin : StdinLock<'a>,
}

impl<'a> Scanner<'a> {
    fn new(cin : StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin : cin }
    }

    fn read1<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 read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}

struct Pos { x: i32, y : i32 }

enum DIR { UR, UL, DL, DR }

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);
    let s = Pos{x : sc.read(), y : sc.read()};
    let t = Pos{x : sc.read(), y : sc.read()};
    let dir =   if s.x < t.x && s.y < t.y { DIR::UR }
                else if s.y < t.y { DIR::UL }
                else if s.x < t.x { DIR::DL }
                else { DIR::DR };
    let (g, b) = match dir {
        DIR::UR => (('R','U'), ('L','D')),
        DIR::UL => (('L','U'), ('R','D')),
        DIR::DL => (('L','D'), ('R','U')),
        DIR::DR => (('R','D'), ('L','U')),
                };
    let mut ans = String::new();
    for _ in 0..(s.x - t.x).abs() { ans.push(g.0) }
    for _ in 0..(s.y - t.y).abs() { ans.push(g.1) }
    for _ in 0..(s.x - t.x).abs() { ans.push(b.0) }
    for _ in 0..(s.y - t.y).abs() { ans.push(b.1) }

    ans.push(b.1);
    for _ in 0..(s.x - t.x).abs()+1 { ans.push(g.0) }
    for _ in 0..(s.y - t.y).abs()+1 { ans.push(g.1) }
    ans.push(b.0); ans.push(g.1);
    for _ in 0..(s.x - t.x).abs()+1 { ans.push(b.0) }
    for _ in 0..(s.y - t.y).abs()+1 { ans.push(b.1) }
    ans.push(g.0);
    println!("{}",ans);
}




Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
long long gcd(long long a,long long b){
    if(a<b)
        swap(a,b);
    if(b==0)
        return a;
    return gcd(b,a%b);
}
long long lcm(long long a,long long b){
    return a/gcd(a,b)*b;
}
int main(){
    int n;
    long long t,ans;
    cin>>n>>ans;
    while(cin>>t)
        ans=lcm(t,ans);
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
void fast()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
}
int main()
{
   fast();
  long long n,x;
    cin>>n; int cnt[200001]={};
   for(int i=0;i<n-1;i++){cin>>x;cnt[x]++;}
   for(int i=1;i<=n;i++)
   {
       cout<<cnt[i]<<'\n';
   }
    return 0;
}


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

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

const char lf = '\n';

namespace ae86
{
	const int bufl = 1<<15;

	char buf[bufl],*s=buf,*t=buf;

	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}

	inline int ty()
	{
		int a=0,b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}
}
using ae86::ty;

const int _ = 300007;

struct tla
{
#define lb(a) ((a)&(-(a)))

	int t[_];
	inline void add(int x,int d){while(x<_)t[x]+=d,x+=lb(x);}
	inline int sum(int x){int d=0;while(x)d+=t[x],x-=lb(x);return d;}
	tla(){memset(t,0,sizeof(t));}
	
#undef lb
}t;

struct cxk
{
	int l,r,len;
	cxk(int _l=0,int _r=0){l=_l,r=_r,len=r-l+1;}
	inline friend int operator < (cxk a,cxk b){return a.len<b.len;}
}dlq[_];

int n,m;

int main()
{
	ios::sync_with_stdio(0),cout.tie(nullptr);

	n=ty(),m=ty();
	for(int i=1,a,b;i<=n;i++)a=ty(),b=ty(),dlq[i]=cxk(a,b);
	sort(dlq+1,dlq+n+1);
	for(int i=1,j=1;i<=m;i++)
	{
		while(j<=n && dlq[j].len<=i)t.add(dlq[j].l,1),t.add(dlq[j].r+1,-1),j++;
		int ans=n-j+1;
		for(int k=i;k<=m;k+=i)ans+=t.sum(k);
		cout<<ans<<lf;
	}
	
	return 0;
}


Measured memory_bytes: 5632
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cin;
using std::cout;
using std::endl;

int main(void) {
    cout << std::fixed << std::setprecision(10);
    cin.tie(0);
    std::ios::sync_with_stdio(false);

    int n;
    std::vector<int> a;
    int b[200010];
    cin >> n;
    for (int i = 0; i < n; i++) {
        int m1;
        cin >> m1;
        a.push_back(m1);
    }
    int front = 0, back = n - 1;
    for (int i = n - 1; i >= 0; i--) {
        if (i % 2 == (n - 1) % 2) {
            b[front] = a[i];
            front++;
        } else {
            b[back] = a[i];
            back--;
        }
    }
    for (int i = 0; i < n - 1; i++) {
        cout << b[i] << " ";
    }
    cout << b[n - 1] << endl;

    return 0;
}


Measured memory_bytes: 4460
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define trav(a, x) for(auto& a : x)
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;

int main(){
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);

    int n;
    cin >> n;
    vi ai(100009);
    vi bi(100009);
    vector<pii> ci;
    rep(i,0,n){
        cin >> ai[i] >> bi[i];
        ci.emplace_back(ai[i]+bi[i],i);
    }
    sort(all(ci));
    reverse(all(ci));
    ll ans=0;
    rep(i,0,n){
        if(i%2==0){
            ans+=ai[ci[i].second];
        }else{
            ans-=bi[ci[i].second];
        }
    }

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


Measured memory_bytes: 2168
#include <stdio.h>
#include <stdlib.h>
#include <math.h>


#define rep(i,r,l) for(int i = r; i < l; i++)
#define elif else if
#define ll long long

int nextint(void){int n;scanf("%d",&n);return n;}
void printint(int d){printf("%d\n",d);}


int main(void){ 

    int d = nextint();
    int t = nextint();
    int s = nextint();

    ((float)d/s<=(float)t)?puts("Yes"):puts("No");

    return 0;
}



Measured memory_bytes: 1660
n,m,k=[int(x) for x in input().rstrip().split()]
a=[int(x) for x in input().rstrip().split()]
b=[int(x) for x in input().rstrip().split()]

A=[0]
B=[0]

for i in range(n):
  A.append(A[i]+a[i])

for i in range(m):
  B.append(B[i]+b[i])

ans=0
j=m

for i in range(n+1):
  # j=m
  if A[i]>k:
    break
  nokori=k-A[i]

  while(nokori<B[j] and 0<=j):
    j-=1

    
  ans=max(ans,i+j)
print(ans)


Measured memory_bytes: 47404
#include<bits/stdc++.h>
    using namespace std;
    int main(){
      int n;
      scanf("%d", &n);
      vector<vector<int>>v(n, vector<int>(3));
      
      for(int i = 0;i<n;i++)
        for(int j=0;j<3;j++)
            scanf("%d", &v[i][j]);
     
      for(int i=1;i<n;i++){
        for(int j=0;j<3;j++){
          int mx = INT_MIN;
          for(int k=0;k<3;k++){
              if(k==j)
                continue;
            mx = max(v[i][j] + v[i-1][k], mx);
          }
          v[i][j] = mx;
          //cout<<v[i][j]<<" ";    
        }
        //cout<<endl;
      }
       int ans = max(max(v[n-1][0], v[n-1][1]), v[n-1][2]);
       cout<<ans<<"\n";  
       return 0;     	
    }

Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;


int main() {
        string s,t;
        int a,b;
        cin >> s >> t;
        cin >> a >>b;
        string u;
        cin >>u;
        if(s==u) a--;
        if(t ==u) b--;
        cout << a << " "<< b << endl;

        return 0;
}




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

int n, m;
int w[110][110];
int p[4][110][110];

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  while (cin >> n >> m, n) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        cin >> w[i][j];
      }
    }
    for (int i = 0; i < m; i++) {
      for (int j = 0; j < m; j++) {
        cin >> p[0][i][j];
      }
    }
    for (int idx = 0; idx < 3; idx++) {
      for (int i = 0; i < m; i++) {
        for (int j = 0; j < m; j++) {
          p[idx + 1][j][m - 1 - i] = p[idx][i][j];
        }
      }
    }
    bool flag = false;
    int ay = n + 1, ax = n + 1;
    for (int i = 0; i + m <= n; i++) {
      for (int j = 0; j + m <= n; j++) {
        for (int idx = 0; idx < 4; idx++) {
          bool yes = true;
          for (int y = 0; y < m; y++) {
            for (int x = 0; x < m; x++) {
              if (p[idx][y][x] == -1) continue;
              yes &= p[idx][y][x] == w[i + y][j + x];
            }
          }
          if (!yes) continue;
          for (int y = 0; y < m; y++) {
            for (int x = 0; x < m; x++) {
              if (p[idx][y][x] == -1) continue;
              int ny = i + y + 1, nx = j + x + 1;
              if (ny <= ay) {
                ay = ny;
                if (nx <= ax) ax = nx;
              }
              y = m, x = m;
            }
          }
        }
      }
    }
    if (ax == n + 1) cout << "NA" << endl;
    else cout << ax << " " << ay << endl;
  }

  return 0;
}


Measured memory_bytes: 3248
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define _ << ' ' <<
using namespace std;
using ll = long long;

const string z[4] = {"WW", "SW", "WS", "SS" };
string sol;
map<char, char> inv = {{'W', 'S'}, {'S', 'W'}};

int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    sol.resize(n);
    for (int i = 0; i < 4; ++i)
    {
        for (int j = 0; j < 2; ++j)
            sol[j] = z[i][j];

        for (int k = 1; k <= n; ++k)
        {
            if (s[k%n] == 'o')
                sol[(k+1)%n] = (sol[k%n] == 'S' ? sol[(k-1+n)%n] : inv[sol[k-1]]);
            else
                sol[(k+1)%n] = (sol[k%n] == 'S' ? inv[sol[(k-1+n)%n]] : sol[k-1]);
        }
        if (sol[0] == z[i][0] && sol[1] == z[i][1])
            return cout << sol, 0;
    }
    cout << -1;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define deb(x) cout<<#x<<"="<<x<<endl;
#define endl '\n'
#define M 1000000007
#define int long long
#define max_n 1000000

using namespace std;

void solve()
{
	vector<string> v;
	ll k;
	cin>>k;
	for (int i = 1; i <= 9; ++i)
	{
		string st="";
		st+=('0'+i);
		v.push_back(st);
		// deb(st)
	}

	for(int i=0;v.size()<100000;++i)
	{
		string s=v[i];
		for(char j=s[s.length()-1]-1;j<=s[s.length()-1]+1;++j)
		{
			if(j>='0' && j<='9')
			{
				string st=s;
				st+=j;
				v.push_back(st);
			}
		}
	}
	cout<<v[k-1]<<endl;
}

int32_t main() 
{ 

	IOS	
	ll T=1;
	// cin>>T;
	for(ll i=1;i<=T;++i)
	{		
		// cout<<"Case #"<<i<<": ";
    	solve();
	}
	return 0;
}

Measured memory_bytes: 6900
#include <iostream>
#include <vector>
using namespace std;
const int MAXN = 50 + 5;
const int MAXM = MAXN * MAXN;
const int BASE = MAXM;
const int MAXL = BASE * 2;
typedef long long i64;

int N, A;
int contrib[MAXN];
i64 DP[MAXN][MAXL];

int main()
{
    int t;
    cin >> N >> A ;
    for(int i = 1; i <= N; i++)
        cin >> t ,
        contrib[i] = t-A;

    DP[0][BASE] = 1;
    for(int i = 0; i <= N; i++)
    {
        for(int j = 0; j < MAXL; j++)
        {
            if(DP[i][j])
            {
                DP[i+1][j + contrib[i+1]] += DP[i][j];
                DP[i+1][j] += DP[i][j] ;
            }
        }
    }

    cout << DP[N][BASE]-1 << endl ;
}


Measured memory_bytes: 1024
import java.util.Scanner;

class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n, m;
		int[] bag;
		int p;
		int v, j;
		int ans;
		
		while(true){
			n = scan.nextInt();
			m = scan.nextInt();
			if(n == 0 && m == 0)break;
			
			bag = new int[n];
			ans = 0;
			for(int i = 0; i < n; i++){
				p = scan.nextInt();
				bag[i] = p;
			}
			
			v = 0;
			j = 0;
			for(int i = 1; i <= n - 1; i++){
				v = bag[i];
				j = i - 1;
				while(j >= 0 && bag[j] < v){
					bag[j + 1] = bag[j];
					j--;
				}
				bag[j + 1] = v;
			}
			
			for(int i = 0; i <= n/m; i++){
				if(i != 0)
				bag[i * m - 1] = 0;
			}
			for(int i = 0; i < n; i++){
				ans += bag[i];
			}
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 63056
#include <stdio.h>

int main () 
{
  int x, y;
  
  while (1)
    {
      {scanf("%d%d",&x,&y);
	if(x==0&&y==0)
	  break;}

    if(x<y) printf("%d %d\n",x,y);
    if(y<x) printf("%d %d\n",y,x);
    if(x==y) printf("%d %d\n",x,y);
}
 
    return 0;
}

Measured memory_bytes: 1028
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <climits>

using namespace std;

int main() {
	int H,W;

	cin >> H >> W;;
	
	while ((H!=0)||(W!=0)) {

		for(int i = 0; i < H; i++) {
			for(int j = 0; j < W;j++) cout << "#";
			cout << endl;
		}
		cout << endl;
		cin >> H >> W;;
	}
	
}



Measured memory_bytes: 3100
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yosiiii
 */


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

class BFizzBuzzSum {
public:
	void solve(std::istream& in, std::ostream& out) {
        int n;
        in >> n;
        ll su=0L;
        for(ll i=1;i<=n;i++){
            if(i%3!=0&&i%5!=0){
                su+=i;
            }
        }
        out << su <<endl;
	}
};


int main() {
	BFizzBuzzSum solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3636
mod=10**9 + 7
#print(bin(9))
N=int(input())
A=list(map(int,input().split()))
A=[bin(i)[2:] for i in A]
A=[(60-len(i)) * "0" + i for i in A]
#print(A)
nowdata=[0 for i in range(60)]
data=[0 for i in range(60)]

#print(A)

for i in range(N-1):
    S=A[i]
    #print(nowdata)
    for a in range(len(S)):
        if S[a]=="1":
            nowdata[a]+=1
    S=A[i+1]
    for a in range(len(S)):
        if S[a]=="0":
            data[a]+=nowdata[a]
        else:
            data[a]+=i+1-nowdata[a]


num=0
#print(data)
for i in range(60):
    num+=data[-i-1]* (2**i)
    num%=mod

print(num)


Measured memory_bytes: 202180
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <cassert>
using namespace std;

int h, w, k;
char board[100][100];

int getboard(int i, int j)
{
	if (i < 0 || j < 0 || i >= h || j >= w)
	{
		return -1;
	}
	return (board[i][j] == '#') ? -1 : ((board[i][j] == '.') ? 0 : (board[i][j] - '0'));
}

const int PMAX = 1 << 12;
int memo[50][50][4][PMAX];
const int hsy[4] = { 1,0,-1,0 };
const int hsx[4] = { 0,1,0,-1 };
const int INF = 123456789;
int dp(int i, int j, int x, int path)
{
	if (x > k || x < 0)return -INF;
	if (i < 0 || j < 0 || i >= h || j >= w)return -INF;
	if (memo[i][j][x][path] != -1)return memo[i][j][x][path];
	int ans = -INF;
	int kk = x;
	if (!(getboard(i, j) < 0))
	{
		for (int d = 0; d < 4; ++d)
		{
			if (d >= 2)
			{
				kk = x - 1;
				if (kk < 0)continue;
			}
			int d2 = d << 10;
			int idp = (path >> 2) % (1 << 10) + d2;
			int cans = dp(i - hsy[path % 4], j - hsx[path % 4], kk, idp);
			int u = hsy[path % 4], v = hsx[path % 4];
			bool flag = false;
			for (int bit = 0; bit < 6; ++bit)
			{
				u += hsy[idp % 4];
				v += hsx[idp % 4];
				idp /= 4;
				if (u == 0 && v == 0)flag = true;
			}
			if (!flag)cans += getboard(i, j);
			ans = max(ans, cans);
		}
	}
	return memo[i][j][x][path] = ans;
}

int main(void)
{
	scanf("%d %d %d", &h, &w, &k);
	for (int i = 0; i < h; ++i)scanf("%s", board[i]);
	memset(memo, 0xFF, sizeof(memo));
	memo[0][0][0][0] = 0;
	int ans = 0;
	for (int x = 0; x <= k; ++x)
	{
		for (int p = 0; p < PMAX; ++p)
		{
			int p2 = p;
			int bcount = 0;
			for (int bit = 0; bit < 6; ++bit)
			{
				if (p2 % 4 >= 2)++bcount;
				p2 /= 4;
			}
			if (bcount > k - x)continue;
			ans = max(ans, dp(h - 1, w - 1, x, p));
		}
	}
	printf("%d\n", ans);
	return 0;
}

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

int main(){
  ll n,m;
  cin >>n>>m;
  vector<int> a(n);
  ll sum=0;
  rep(i,n){
    cin >>a[i];
    sum +=a[i];
  }
  sort(a.begin(), a.end(),greater<int>());
  
  ll cr;
  if(sum%(4*m)==0) cr=sum/(4*m);
  else cr=sum/(4*m)+1;
  
  if(a[m-1]<cr) cout <<"No"<<endl;
  else cout <<"Yes"<<endl;
  
}


Measured memory_bytes: 3632
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i==n-1];};
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    ll N,M;
    cin >> N >> M;
    ll A[310][310];
    rep(i,0,N){
        rep(j,0,M){
            cin >> A[i][j];
            A[i][j]--;
        }
    }
    bool play[310];
    rep(i,0,M) play[i] = true;
    ll ans = INF;
    while(1){
        bool end = true;
        rep(i,0,M){
            if(play[i] == true) end = false;
        }
        if(end) break;
        ll num[310] = {};
        rep(i,0,N){
            rep(j,0,M){
                if(A[i][j] != -1){
                    num[A[i][j]]++;
                    break;
                }
            }
        }
        ll max_val = 0;
        rep(i,0,M){
            max_val = max(max_val, num[i]);
        }
        ans = min(ans, max_val);
        rep(i,0,N){
            rep(j,0,M){
                if(A[i][j] != -1){
                    if(num[A[i][j]] == max_val){
                        play[A[i][j]] = false;
                        A[i][j] = -1;
                    }
                }
            }
        }
    }
    print(ans);
    // rep(i,0,N){
    //     num[A[i][0]]++;
    // }
    // ll ans = INF
    // ll mv = 0;
    // rep(i,1,M+1) mv = max(mv, num[i]);



}

Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vl;
typedef vector<vector<int> > vvi;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    int n;
    cin >> n;
    map<int, int> m;
    for(int i = 0; i < n; i++){
        int x;
        cin >> x;
        m[x]++;
    }
    vector<pair<int, int> > p;
    map<int, int> :: iterator it;
    for(it = m.begin(); it != m.end(); it++){
        if(it->second > 1){
            p.pb(mp(it->first, it->second));
        }
    }
    if(p.size()==0){
        cout << 0;
        return 0;
    }
    sort(rall(p));
    if(p[0].second >= 4){
        ll ans = p[0].first;
        cout << ans * ans;
    }
    else{
        ll ans1 = p[0].first;
        ll ans2 = p[1].first;
        cout << ans1 * ans2;
    }
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int Q;
ll F[91];
ll X,Y;

vector<pair<ll,ll>> cand[91];
ll mo=1000000007;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	F[0]=F[1]=1;
	for(i=2;i<=89;i++) {
		F[i]=F[i-1]+F[i-2];
		for(j=2;j<=i+1;j++) {
			ll a=1,b=1;
			for(x=2;x<=i;x++) {
				ll c=b+a;
				if(x==j) c+=a;
				b=a;
				a=c;
			}
			cand[i].push_back({a,a+b});
			cand[i].push_back({a+b,a});
		}
	}
	
	
	cin>>Q;
	while(Q--) {
		cin>>X>>Y;
		
		if(X>Y) swap(X,Y);
		if(X==1 || (X==2&&Y==2)) {
			cout<<1<<" "<<(X*Y)%mo<<endl;
			continue;
		}
		
		int k=0;
		while(F[k+1]<=X && F[k+2]<=Y) k++;
		ll ret=0;
		FORR(r,cand[k]) if(X>=r.first && Y>=r.second) {
			(ret += 1+(Y-r.second)/r.first)%=mo;
		}
		cout<<k<<" "<<ret<<endl;
		
	}
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

void solve_abc_a() {
	string n;
	string ans = "No";

	cin >> n;

	rep(i, n.size()) {
		if (n[i] == '7') {
			ans = "Yes";
			break;
		}
	}

	cout << ans << "\n";
}

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

	solve_abc_a();

	return 0;
}

Measured memory_bytes: 3604
#include<algorithm>
#include<iostream>
using namespace std;
int a[10050];
int main()
{
	int n,t=0,sum=0;
	int x;
	cin>>n>>x;
	a[0]=0;
	for(int i=1; i<=n; i++)
	{
		cin>>t;
		a[i]=t+a[i-1];
	}
	for(int i=0; i<=n; i++)
	{
		if(a[i]<=x)
			sum++;
	}
	cout<<sum<<endl;
	return 0;
}

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

// types
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<pll> vpl;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};


int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll h,w,k;
  cin >> h >> w >> k;
  k--;
  ll dp[h+1][w];
  REP(i, h+1){
    REP(j, w)
      dp[i][j]=0;
  }

  dp[0][0]=1;
  REP(i, h){
    REP(j, w){


      REP(bit, (1<<w-1)){
        //check validation
        bool flag = false;
        REP1(b, w-1){
          if((bit&(1<<b)) && (bit&(1<<b-1)))
            flag = true;
        }
        if(flag)
          continue;

        //dp calc
        if(bit&(1<<j) && j<w-1){
          dp[i+1][j+1] += dp[i][j];
          dp[i+1][j+1] %= MOD;
        }
        else if(bit&(1<<j-1) && j-1>=0){
          dp[i+1][j-1] += dp[i][j];
          dp[i+1][j-1] %= MOD;
        }
        else{
          dp[i+1][j] += dp[i][j];
          dp[i+1][j] %= MOD;
        }


      }
    }


  }

  cout << dp[h][k] << endl;
}


Measured memory_bytes: 384
a,b,c,k=map(int,input().split())
sum=0
f=True
if(k>a):
    sum+=a
    k-=a
else:
    sum=k
    f=False
if (f):    
    k=k-b
    if(k<0):
        f=False
    if (f):
        sum-=(min(k,c))
print(sum)
        

Measured memory_bytes: 9184
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

class Main {
    int N, C;
    vector<vector<P>> st;
    void input() {
        cin >> N >> C;
        st.resize(C + 1);
        REP(i, N) {
            int s, t, c;
            cin >> s >> t >> c;
            st[c].emplace_back(s, t);
        }
    }
    void output() {
        vector<int> imos(100002);
        FOR(c, 1, C + 1) {
            SORT(st[c]);
            vector<P> tmp;
            for (auto &p : st[c]) {
                if (tmp.empty() || p.first - tmp.back().second > 1) {
                    tmp.emplace_back(p);
                } else {
                    tmp.back().second = p.second;
                }
            }
            for (auto &p : tmp) {
                imos[p.first]++;
                imos[p.second + 1]--;
            }
        }
        REP(i, 100000) { imos[i + 1] += imos[i]; }
        cout << *max_element(imos.begin(), imos.end()) << endl;
    }

public:
    Main() {
        input();
        output();
    }
};

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

    Main();

    return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ii pair<int, int>
#define vi vector<int>
#define vii vector<ii>
#define vll vector<ll>
#define vvi vector<vector<int>>
#define vvii vector<vector<ii>>
#define vvll vector<vector<ll>>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define uni(v) v.erase(unique(v.begin(), v.end()), v.end())
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (ll) a / __gcd(a, b) * b
#define what_is(x) cerr << #x << " is " << x << endl;

using namespace std;

void write();
template <typename T, typename... Args>
void write(T x, Args... args);

void solve() {
    string s;
    cin >> s;
    write((s.size() == 6 && s[2] == s[3] && s[4] == s[5] ? "Yes" : "No"));
}
int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    // freopen("in", "r", stdin);

    int t = 1;
    // cin >> t;
    while (t--) solve();

    return 0;
}
template <typename T, typename... Args>
void write(T x, Args... args) {
    cout << x;
    if (sizeof...(args)) {
        cout << ' ';
        write(args...);
    } else
        cout << '\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = b - 1; i >= a; i--)
#define ALL(a) a.begin(), a.end()
#define pii pair<int,int>
#pragma GCC optimize("Ofast")
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
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(a>b){a = b; return 1;} return 0; };
inline void IN(void){return;}
template <typename First, typename... Rest> void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
inline void OUT(void){cout << "\n";return;}
template <typename First, typename... Rest> void OUT(First first, Rest... rest){cout << first << " ";OUT(rest...);return;}
const double EPS = 1e-9;
const int mod = 1e9 + 7;
const int INF = 1e9;
const long long LLINF = 1e18;
long long lcm(ll a, ll b){return a * b / __gcd(a,b);}
struct IoSetup { IoSetup() {
    cin.tie(nullptr);ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
} } iosetup;
template< int mod > struct ModInt {
    int x; ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) {if((x += p.x) >= mod) x -= mod;return *this;}
    ModInt &operator-=(const ModInt &p) {if((x += mod - p.x) >= mod) x -= mod;return *this;}
    ModInt &operator*=(const ModInt &p) {x = (int) (1LL * x * p.x % mod);return *this;}
    ModInt &operator/=(const ModInt &p) {*this *= p.inverse();return *this;}
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) { t = a / b; swap(a -= t * b, b); swap(u -= t * v, v); }return ModInt(u);}
    ModInt pow(int64_t n) const {ModInt ret(1), mul(x); while(n > 0) {if(n & 1) ret *= mul;mul *= mul;n >>= 1;}return ret;}
    friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x;}
    friend istream &operator>>(istream &is, ModInt &a) { int64_t t; is >> t; a = ModInt< mod >(t); return (is); }
    static int get_mod() { return mod; }
}; using modint = ModInt< mod >;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){
    iosetup;
    string S, T; cin >> S >> T;
    int A, B; cin >> A >> B;
    string U; cin >> U;
    if(S == U) A--;
    else B--;
    cout << A << " " << B << endl;

    return 0;
}

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


using namespace std;


int n, m;

vector<int> q;
vector<int> p;
vector<vector<int>> ss;


bool valid(int query) {
    fill(q.begin(), q.end(), 0);

    for (int i=0; i<n; i++) {
        // whether i'th switch is pushed
        if (!(query>>i & 1)) continue;

        // i'th switch is pushed.
        // then which lights are incremented?
        for (int j=0; j<m; j++) {
            if (find(ss.at(i).begin(), ss[i].end(), j) != ss[i].end()) {
                q[j]++;
            }
        }
    }

    // cout << "# r ---" << endl;
    // for (int q_i: q) {
    //     cout << q_i << " ";
    // }
    // cout << endl;
    // cout << "# ---" << endl;

    // cout << "# p ---" << endl;
    // for (int p_i: p) {
    //     cout << p_i << " ";
    // }
    // cout << endl;
    // cout << "# ---" << endl;

    int cnt = 0;
    for (int i=0; i<m; i++) {
        if (q[i] % 2 == p[i]) cnt++;
    }
    return cnt == m;
}


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

    int k, v;
    ss.resize(n);
    for (int i=0; i<m; i++) {
        cin >> k;

        for (int j=0; j<k; j++) {
            cin >> v; v--;
            ss[v].push_back(i);
        }
    }

    q.resize(m);
    p.resize(m);
    for (int i=0; i<m; i++) cin >> p[i];

    // cout << "# ---" << endl;
    // for (vector<int> ss_i: ss) {
    //     for (int ss_ij: ss_i) cout << ss_ij << ' '; cout << endl;
    // }
    // cout << "# ---" << endl;

    int ans = 0;
    for (int i=0; i<(int)pow(2, n); i++) {
        // cout << "query: " << i << endl;
        if (valid(i)) ans++;
    }

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



Measured memory_bytes: 256
//神题
#include<cstdio>
#include<cstring>
#include<algorithm>
#define N 410
using namespace std;
int n, m, du[N], f[N], size[N], flag[N], A, B, C, D, x, y, x1, y1;
inline int gether(int x){return f[x]?f[x]=gether(f[x]):x;}
int main(){
	scanf("%d%d", &n, &m); m<<=1;
	memset(du, 0, sizeof(du)); memset(f, 0, sizeof(f)); memset(size, 0, sizeof(size));
	for(int i=1; i<=n; i++){
		scanf("%d%d%d%d", &A, &B, &C, &D);
		x=C?-C:A; y=D?D:-B; if(x<=0)x+=m+1; if(y<=0)y+=m+1;
		du[x]++; du[y]--;
		x1=gether(x); y1=gether(y); if(x1!=y1){f[y1]=x1; size[x1]+=size[y1];} size[x1]++;
	}
	for(int i=1; i<=m/2; i++)if(du[i]<=-1){printf("NO"); return 0;}
	for(int i=m/2+1; i<=m; i++)if(du[i]>=1){printf("NO"); return 0;}
	memset(flag, 0, sizeof(flag));
	for(int i=1; i<=m; i++)if(du[i])flag[gether(i)]=1;
	for(int i=1; i<=m; i++)if(!f[i]&&size[i]&&!flag[i]){printf("NO"); return 0;}
	printf("YES");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
using namespace std;
using ll = long long;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[10000001];
//char str[1010][1010];
//vector<pair<int,int> > pc[100001];
//int ABS(int a){return max(a,-a);}
int f[100][14];
int p[100][15];
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		for(int j=0;j<10;j++) cin>>f[i][j];
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<11;j++) cin>>p[i][j];
	}
	int res=-(1<<30);
	for(int b=1;b<(1<<10);b++){
		int tmp=0;
		for(int i=0;i<n;i++){
			int c=0;
			for(int j=0;j<10;j++){
				if((b>>j&1)&&f[i][j]) c++;
			}
			tmp+=p[i][c];
		}
		if(res<tmp) res=tmp;
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
#include <numeric>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<ll, ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<P> vp;
typedef vector<bool> vb;
#define rep(i, a, n) for (ll i = (a); i < (n); ++i)
#define rrep(i, a, n) for (ll i = (a); i > (n); --i)
#define erep(i, a, n) for (ll i = (a); i <= (n); ++i)
#define rerep(i, a, n) for (ll i = (a); i >= (n); --i)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define vec_max(V) *max_element(all(V))
#define vec_min(V) *min_element(all(V))
#define vec_sum(V) accumulate(all(V), 0LL)
#define print(X) cout << (X) << "\n"
#define _ << " " <<
#define Yes print("Yes")
#define No print("No")
static const int INF = 1e+9+7;

int main(){
  int N;
  cin >> N;
  vi P(N);
  rep(i,0,N) cin >> P[i];
  print(vec_sum(P) - int(vec_max(P)/2));


  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	char n[100];
	
	scanf("%s",n);
	
	if(n[1]==n[2]){
		if(n[1]==n[0]||n[2]==n[3]){
			printf("Yes\n");
		}else{
			printf("No\n");
		}
	}else{
		printf("No\n");
	}
	
	return 0;
}

Measured memory_bytes: 128
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2019-12-22 19:45:41
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;
template<class T> ostream& operator<<(ostream& os, vector<T>& _) { os << '{'; for (T& x : _) { os << x; if (&x != &_.back()) os << ','; } os << '}'; return os; }
template<class T, class U> ostream& operator<<(ostream& os, pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }

#ifdef LOCAL
#define debug(_) cerr << #_ << ": " << (_) << '\n'
#else
#define debug(_) 1728
#endif

template<class T> T gcd(T x, T y) {
  while (y > 0){
    T tmp = x % y;
    x = y;
    y = tmp;
  }
  return x;
}

template<class T> T lcm(T x, T y) {
  if (x == 0 || y == 0) return 0;
  else return x * y / gcd(x, y);
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int64 a, b; cin >> a >> b;
  cout << lcm(a, b) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int x,y;
    char op;
    while(cin >> x >> op >> y){
        if( op == '+' ){
            cout << x + y << endl;
        }
        else if( op == '-' ){
            cout << x - y << endl;
        }
        else if( op == '*' ){
            cout << x * y << endl;
        }
        else if( op == '/' ){
            cout << x / y << endl;
        }
        else{
            break;
        }
    }
    
    return 0;
}



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

#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384


int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;} 
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}    //最大公約数
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}     //最小公倍数
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;} //コンビネーション
int nHr(int a,int b){return nCr(a+b-1,b);}       // 重複組み合わせ
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}  //階乗
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;} // a~bまでの階乗
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}   //数字の各位の和
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}  // b進数の各位の和？
int sankaku(int x){return ((1+x)*x)/2;} //三角数 xまでの和

//以下long long ver
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llnHr(long long a,long long b){return llnCr(a+b-1,b);}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}
long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}
long long llsankaku(long long x){return ((1+x)*x)/2;}

//double
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}


typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
#define forr(i,a,b) ; for(int i=(a); i<(b); i++)
#define clean(arr,val) memset(arr,val,sizeof(arr))
#define forn(i,n) forr(i,0,n)
#define PB push_back
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<pll> vpll;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
bool is_prime (int x){
  if (x<=1) return false ;
  for (int i=2 ; i*i<=x ; i++){
    if (x%i==0) return false ;
  }
   return true;
}

 
/*CODE START HERE*/
int main() {
  int n,m;
  cin >> n >> m;
  vector <int > count(m,0);
  forn(i,n){
    int k;
    cin >> k;
    forn(j,k){
      int a;
      cin >> a;
      count.at(a-1) ++ ;
    }
  }
  int counter = 0;
  forn(i,m){
    if ( count.at(i) == n){
      counter ++ ;
    }
  }
  cout << counter << endl;
}

Measured memory_bytes: 3616
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        o: chars,
        e: chars,
    }

    let i = std::cmp::max(o.len(), e.len());

    let mut o = o.into_iter();
    let mut e = e.into_iter();

    println!(
        "{}",
        (0..i).fold(String::new(), |mut acc, _| {
            if let Some(x) = o.next() {
                acc.push(x);
            }
            if let Some(x) = e.next() {
                acc.push(x);
            }
            acc
        })
    );
}

Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    int n;  cin>>n;
    vector<int[2]>d(n);
    rep(i, n)   cin>>d[i][0]>>d[i][1];
    bool flag = false;
    rep(i, n-2){
        bool tmp = true;
        rep(j, 3){
            if(d[i+j][0] != d[i+j][1])  tmp = false;
        }
        if(tmp) flag = true;
    }
    if(flag){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3632