akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
using System.Collections.Generic;


public class CoinChanging
{
    public static void Main()
    {
        var inputs = Console.ReadLine().Split(' ').Select(int.Parse);
        var n = inputs.First();
        
        var coins = Console.ReadLine().Split(' ').Select(int.Parse);
        
        var totals = coins.ToList();
        var count = 1;
        
        var max = coins.Max();
        
        while (totals.All(x => x != n))
        {
            count++;
            
            totals = totals.SelectMany(x => 
            {
                return n - x > max * 20
                    ? new int[] { x + max }
                    : coins.Select(y => x + y);
//                return coins.Select(y => x + y);
            }).ToList();
            totals.RemoveAll(x => x > n);
            totals = totals.Distinct().ToList();
        }
    
        Console.WriteLine(count);
    
    }
}

// Define other methods and classes here

Measured memory_bytes: 23020
#include<bits/stdc++.h>
using namespace std;int n,m,p,a[1<<17],i,r,V,W,X;main(){cin>>n>>m>>p;for(i=0;i<m;i++){cin>>a[i];a[i]+=n-p;a[i]%=n;}sort(a,a+m);r=min(a[m-1],n-a[0]);for(int i=0;i<m-1;i++){V=a[i],W=n-a[i+1];if(V>W)swap(V,W);X=2*V+W;r=min(r,X);}cout<<r*100<<endl;}

Measured memory_bytes: 1220
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils,Classes;
var
  h,w,i,j,count,x,y,sw,m,n,a,b,c:Integer;
  s123,s1,s2,s3:string;
  tf:Boolean;
  nyu:TStringList;
begin
  try
    { TODO -oUser -cConsole Main : ここにコードを記述してください }
    Read(x);
    Read(a);
    Readln(b);

    if a-b>=0 then
      Writeln('delicious')
    else if x+a>=b then
      Writeln('safe')
    else
      Writeln('dangerous');
    Readln;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.


Measured memory_bytes: 256
#include <bits/stdc++.h>
     
using namespace std;
typedef long long ll;
      
int main(void){
    int a, b, c, d;
    
    cin >> a >> b >> c >> d;
    //cout << sqrt(a) << " " << sqrt(b) << " " << sqrt(c) << endl;
    while (a>0 && c>0) {
        c -= b;
        //cout << "c = " << c << endl;
        if (c<=0) break;
        a -= d;
        //cout << "a = " << a << endl;
        if (a<=0) break;
    } 
    if (c<=0) {
        cout << "Yes";
    } else {
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=(a);i<(b);i++)
#define fore(i,a,b) for(int i=(a);i<=(b);i++)
#define pb push_back
#define F first
#define S second
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
void amin(ll &a, ll b){ a=min(a,b); }
void amax(ll &a, ll b){ a=max(a,b); }
void SD(int t=0){ cout<<"PASSED "<<t<<endl; }
const ll INF = ll(1e18);
const int MOD = 998244353;

const int MAXN = 100005;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	ll a,b; cin>>a>>b;
	if(a<=0 && b>=0){ cout<<"Zero\n"; exit(0); }
	
	if(a>0) {cout<<"Positive\n"; exit(0);}
	
	if((b-a+1)%2==0) cout<<"Positive\n"; 
	else cout<<"Negative\n";
	
	return 0;
}


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

#define ll long long
#define MOD 1000000007
#define LLMN LONG_LONG_MIN
#define LLMX LONG_LONG_MAX
#define MAX 1000000

vector<bool>prime(MAX, true);
vector<ll>fact(MAX);
vector<ll>factinv(MAX);

ll  fastpower(ll a, ll n)
{
	ll res = 1;
	while(n > 0)
	{
		if(n % 2 != 0)
		{
			res = (res * a) % MOD;
		}
		n /= 2;
		a=(a * a) % MOD;
	}
	return res;
}

void getprime()
{
	for(ll i = 2;i < MAX; i++)
	{
		if(prime[i-1])
		{
			for(ll j = i*i; j < MAX; j += i)
				prime[j-1] = false;
		}
	}
}

void getfact()
{
	fact[0] = 1;
	factinv[0] = 1;
	
	for(ll i = 1; i < MAX; i++)
		fact[i] = (fact[i-1] * i)%MOD;
	
	for(ll i = 1; i < MAX; i++)
		factinv[i] = (factinv[i-1] * fastpower(i, MOD -2) )%MOD;

}
/*
char find(char x, vector<char>&par)
{
	if(par[x]=='$')
		return x;
	else
		return find(par[x], par);
}
void unionn(char x, char y, vector<char>par)
{
	char a=find(x,par);
	char b=find(y,pR);
	if(a!=b)
	{
		par[a]=b;
	}
}
*/
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll t,n,q;
	cin>>t;
	long double c;
	c=2*t*M_PI;
	cout<<setprecision(12)<<c;
	return 0;
}

Measured memory_bytes: 18908
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <cstring>
#include <string>
#include <stack>
#include <tuple>

using namespace std;
typedef long long ll;
ll MOD = 1e9 + 7;

int main()
{
    string s;
    cin >> s;
    cout << string(s.begin(), s.begin() + 4) + " " + string(s.begin() + 4, s.end()) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,a,n) for(int i=a;i<n;i++)
#define mp(i,j) make_pair(i,j)
#define debug_v(v,N) for(int i=0;i<N;i++) { cout << v[i] << " "; } cout << endl;
#define debug_vv(v,H,W) for(int i=0;i<H;i++) { for(int j=0;j<W;j++) { cout << v[i][j] << " "; } cout << endl; }

typedef long long ll;
typedef pair<int, int> P;

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; }

void Main()
{
	int N; cin >> N;
	int _n = N;
	int s = 0;
	while (_n > 0) {
		s += _n % 10;
		_n /= 10;
	}
	cout << (N % s == 0 ? "Yes" : "No") << endl;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int card[4][14],n,i,j,d;
    char c;
    scanf("%d",&n);
    for(i=0;i<4;i++){
        for(j=0;j<14;j++){
            card[i][j]=0;
        }
    }
    for(i=0;i<n;i++){
        scanf(" %c %d",&c,&d);
        if(c=='S'){
            card[0][d]=1;
        }else if(c=='H'){
            card[1][d]=1;
        }else if(c=='C'){
            card[2][d]=1;
        }else if(c=='D'){
            card[3][d]=1;
        }
    }
    for(i=0;i<4;i++){
        for(j=1;j<14;j++){
            if(card[i][j]==1){
            }
            else{
                if(i==0){
                    printf("S");
                }else if(i==1){
                    printf("H");
                }else if(i==2){
                    printf("C");
                }else if(i==3){
                    printf("D");
                }
                printf(" ");
                printf("%d\n",j);
            }
        }
    }
    return 0;
}

Measured memory_bytes: 600
import sys
from collections import defaultdict

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, m = map(int, input().split())
    A = list(map(int, input().split()))

    A_sum = [0]
    for a in A:
        A_sum.append((A_sum[-1] + a) % m)

    D = defaultdict(int)
    res = 0
    for i in range(n + 1):
        res += D.get(A_sum[i], 0)
        D[A_sum[i]] += 1
    print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 21948
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int s,n=1;
  cin >> s;
  vector<int> hai_m ={s};
  bool flag =false;
  while(true){
    if(s%2==0){
      s = s/2;
    }else{
      s =3*s+1;
    }
    hai_m.push_back(s);
    n++;
    for(int i=0;i<n-1;i++){
      if(hai_m.at(i)==hai_m.at(n-1)){
        flag =true;
        break;
      }
    }
    if(flag==true){
      break;
    }
  }
  cout << n <<endl;
}

Measured memory_bytes: 256
use std::io;

fn read_line() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s
}

macro_rules! from_line {
    ($($a:ident : $t:ty),+) => {
        $(let $a: $t;)+
        {
            let _line = read_line();
            let mut _it = _line.trim().split_whitespace();
            $($a = _it.next().unwrap().parse().unwrap();)+
                assert!(_it.next().is_none());
        }
    };
}

fn main() {
    let array = &mut [0, 0, 0];
    let _a: i32;
    let _b: i32;
    let _c: i32;

    from_line!(a: i32, b: i32, c: i32);
    array[0] = a;
    array[1] = b;
    array[2] = c;
    array.sort();
    println!("{} {} {}", array[0], array[1], array[2]);
}



Measured memory_bytes: 5024
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

typedef long long LL;

const int maxn=2e5+5;

int n,b[maxn],b0;

int ans[maxn];
int main()
{
	scanf("%d",&n);
	fo(i,1,n) scanf("%d",&b[i]);
	b0=n;
	
	fo(i,1,n)
	{
		fd(j,b0,1) if (b[j]==j)
		{
			ans[n-i+1]=j;
			fo(k,j,b0-1) b[k]=b[k+1];
			b0--;
			break;
		}
	}
	
	if (b0) puts("-1");
		else fo(i,1,n) printf("%d\n",ans[i]);
}

Measured memory_bytes: 764
#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>;

int main()
{
  string s;
  cin >> s;
  ll q;
  cin >> q;
  bool rev = false;
  vector<char> str(s.size());
  rep(i, s.size()) str[i] = s[i];
  rep(i, q)
  {
    int op;
    cin >> op;
    if (op == 1)
      rev = !rev;
    else
    {
      int fb;
      cin >> fb;
      char c;
      cin >> c;
      if (fb == 1 && !rev || fb == 2 && rev)
      {
        str.insert(str.begin(), c);
      }
      else
      {
        str.push_back(c);
      }
    }
  }
  if (rev)
    reverse(str.begin(), str.end());
  rep(i, str.size()) printf("%c", str[i]);
  cout << endl;
  return 0;
}

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

const int NMAX = 100010;

int n, a[NMAX], ret;

int main(){
    cin >> n;
    for(int i=1; i<=n; i++) cin >> a[i];
    ret = 1;
    bool isup = false;
    bool isdown = false;
    for (int i=2; i<=n; i++){
        if(!isup && !isdown && a[i-1] < a[i]){
            isup = true;
        }else if(!isup && !isdown && a[i-1] > a[i]){
            isdown = true;
        }else if(!isup && isdown && a[i-1] < a[i]){
            ret++;
            isdown = false;
        }else if(isup && !isdown && a[i-1] > a[i]){
            ret++;
            isup = false;
        }
    }
    cout << ret;
    return 0;
}


Measured memory_bytes: 3980
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
bool test = 0;
int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
#define MAX (int)1e6 + 5

int bit_count(int N) {
	int cnt = 0;
	while (N) {
		if (N & 1) cnt++;
		N >>= 1;
	}
	return cnt;
}

signed main(void) {
	int i, j, k, l;
	int N, M, K;
	int a[18], b[18];
	cin >> N >> M >> K;
	rep(i, N) cin >> a[i];
	rep(i, N) cin >> b[i];

	int mask;
	int cnt = 0;
	rep(mask, 1 << N) {
		int mask_cnt = 0;
		vector<pair<int,int>> mask_pr;
		if (bit_count(mask) != K) continue;
		rep(i, N) {
			if ((mask >> i) & 1) {
				mask_pr.push_back({ a[i],b[i] });
			}
		}
		int cur_poteto = M;
		sort(ALL(mask_pr));
		for(i=K-1;i>-1;i--) {
			mask_cnt += mask_pr[i].first * min(mask_pr[i].second, cur_poteto);
			cur_poteto -= mask_pr[i].second;
			if (cur_poteto < 0) break;
		}
		mask_cnt += max(cur_poteto, 0);
		if (cnt < mask_cnt) {
			//cerr << "!";
			//rep(i, K) {
			//	cerr << mask_pr[i].first << " ";
			//}
			//dump(mask_cnt);
			cnt = mask_cnt;
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3096
n = int(input())
a = list(map(int, input().split()))

alice = []
bob = []


while len(a) > 0:
  alice.append(max(a))
  a.remove(max(a))
  if len(a) > 0:
    bob.append(max(a))
    a.remove(max(a))
  else:
    break
    
  
print(sum(alice)-sum(bob))

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
const ll INF = (ll)1000000007*1000000007;
typedef pair<int, int> P;
typedef unsigned int ui;
int main(){
	char t;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> t;
		if (t == 'Y') {
			cout << "Four" << endl;
			return 0;
		}
	}
	cout << "Three" << endl;
	char nyaa;
	cin >> nyaa;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    int ans = 0;
    if(k<=a){
        cout<<k;
        return 0;
    }
    if(k<=a+b)
        cout<<a;
    else
        cout<<a-min((k-a-b),c);
}

Measured memory_bytes: 3636
import java.util.Scanner;

/**
 * Created by khrom on 2017/06/11.
 */
public class Main {
    public static void main(String[] args) {
        Scanner square = new Scanner(System.in).useDelimiter("\\s");
        int a = square.nextInt();
        int b = square.nextInt();
        if (a == b) {
            System.out.println("a == b");
        } else if (a < b) {
            System.out.println("a < b");
        } else if (a > b) {
            System.out.println("a > b");
        }
    }
}

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

int main(){
  int K;
  bool able =  false;
  int A,B;
  cin >> K;
  cin >> A >> B;
  for(int i=A; i<=B; i++){
    if(i%K==0) able = true;
  }
  if(able) cout << "OK" << endl;
  else cout << "NG" << endl;
  return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;

#if 1
//whileで小さくしてく
ll gcd(ll x,ll y){
  if(x<y) swap(x,y);
  //xの方が常に大きい
  while(y>0){
    ll r=x%y;
    x=y;
    y=r;
  }
  return x;
}

#endif

#if 1

ll lcm(ll x,ll y){
  //かけるで大きくなりすぎる
  return ll(x/gcd(x,y))*y;
}

#endif

int main(){
  ll n;cin >> n;
  ll ans=1;
  for(int i=0;i<n;i++){
    //cout << ans << endl;
    ll t;cin >> t;
    ans=lcm(ans,t);
  }
  cout << ans << endl;
}


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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a, b) accumulate(all(a), b)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
typedef unsigned long long ull;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
ll const INF = 1e18;

template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}


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

    int m = 2, sum = 1;
    vector<vector<int>> v = {{1}, {1}};

    while(sum < n){
        vector<int> u;
        REP(i, m){
            u.push_back(sum + i + 1);
            v[i].push_back(sum + i + 1);
        }
        v.push_back(u);
        sum += m;
        m++;
    }

    if(sum == n){
        cout << "Yes" << endl << v.size() << endl;
        for(auto i : v){
            cout << i.size();
            for(auto j : i){
                cout << " " << j;
            }
            cout << "\n";
        }
    }else{
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    rep(i, 0, S.size() - 1) {
        if (S[i] == 'A' && S[i + 1] == 'C') {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
public class Main {

  private static void solve() {
    int n = ni();
    double l = nl();
    double[] phi = new double[n];
    for (int i = 0; i < n; i++) {
      phi[i] = Math.PI * 2 * nl() / l;
    }

    double x = 0;
    double y = 0;
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        double theta = (phi[i] + phi[j]) / 2;
        double cx = Math.cos(theta);
        double cy = Math.sin(theta);

        double dx = Math.cos(theta + Math.PI);
        double dy = Math.sin(theta + Math.PI);

        x -= cx * (j - i - 1) + dx * (i + (n - j - 1));
        y -= cy * (j - i - 1) + dy * (i + (n - j - 1));
      }
    }
    long total = (long) n * (n - 1) * (n - 2) / 6;
    System.out.printf("%.12f %.12f\n", x / total, y / total);
  }



  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}



Measured memory_bytes: 24252
#include<stdio.h>
#define N 8
#define T 1
#define F 0
#define FREE -1
#define NOT_FREE -2

int row[N],col[N],dpos[2*N-1],dneg[2*N-1];

int X[N][N];

void initialize()
{
  int i;
  for(i=0;i<N;i++)
    {
      row[i] = FREE;
      col[i] = FREE;
    }
  for(i=0;i<2*N-1;i++)
    {
      dpos[i] = FREE;
      dneg[i] = FREE;
    }
}


void printBoard()
{
  int i,j;
  for(i=0;i<N;i++)
    {
      for(j=0;j<N;j++)
	{
	  if(X[i][j])
	    {
	      if(row[i] != j)return ;
	    }
	}

    }
  for(i=0;i<N;i++)
    {
      for(j=0;j<N;j++)
	{
	  if(row[i] == j)
	    printf("Q");
	  else printf(".");
	}
      printf("\n");
    }
}

     
void putQueen(int i)
{
  int j;
  if(i==N)
    {
      printBoard();
	return;
    }

  for(j=0;j<N;j++)
  {
    if(col[j] == NOT_FREE || dpos[i+j] == NOT_FREE || dneg[i-j+N-1] == NOT_FREE)
      continue;
    row[i] = j;
    col[j] = dpos[i+j] = dneg[i-j+N-1] = NOT_FREE;
    putQueen(i+1);
   row[i] = col[j] = dpos[i+j] = dneg[i-j+N-1] = FREE;
  }
}




int main()
{

  int k,r,c,i,j;
  initialize();


  for(i=0;i<N;i++)
    {
      for(j=0;j<N;j++)
	{
	  X[i][j] = F;
	}
    }

  scanf("%d",&k);
  for(i=0;i<k;i++)
    {
      scanf("%d %d",&r,&c);
      X[r][c] = T;
    }
  putQueen(0);

  return 0;
}



Measured memory_bytes: 2112
#include <vector>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
using namespace std;

int main(){
    long long int n,b,c;
    cin >> n ;
    long long int a=1%1000000007;
    for(int i=1;i<=n;i++){
        a=i*a%(1000000000+7);
    }
    cout << a << "\n";
}

Measured memory_bytes: 256
#include <iostream>

#define REP(i,a,b) for(int i=int(a);i<int(b);i++)

using namespace std;

typedef long long int lli;

int main () {
    lli X;
    cin >> X;
    lli i = 0;
    while (i * (i + 1) / 2 < X) i++;
    cout << i << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	static final boolean SHARP = true;
	static final boolean DOT = false;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int h = sc.nextInt();
			int w = sc.nextInt();
			if (h == 0 || w == 0) {
				sc.close();
				break;
			}
			StringBuilder sb = new StringBuilder();
			boolean rowToggle = SHARP;
			for (int i = 0; i < h; i++) {
				boolean charToggle = rowToggle;
				for (int j = 0; j < w; j++) {
					char c = charToggle ? '#' : '.';
					sb.append(c);
					charToggle = charToggle ? DOT : SHARP;
				}
				sb.append("\n");
				rowToggle = rowToggle ? DOT : SHARP;
			}
			System.out.println(sb);
		}
	}
}

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

int main (void)
{
    int n;
  	char C[100];
   	cin>>n;
	bool f = 1;
  	for(int a = 0;a<n;a++)
    {
      cin>>C[a];
    }
  
  if(n%2==1) cout<<"No"<<endl;
  
  else{
    for(int b=0;b<n/2;b++)
    {
    	if(C[b]!=C[b+n/2]) f =0;
    }
    if(f==1) cout<<"Yes"<<endl;
    else 	cout<<"No"<<endl;
   }
   return 0;
   }

Measured memory_bytes: 764
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<string>
#include<math.h>
#include<stdlib.h>
#include<time.h>
#include<map>
#include<queue>
#include<set>
#define ji -
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define fe(x) for(int i=be[x];i;i=e[i].ne)
using namespace std;
int n,a[110000],mi,ma,A,B;
int main(){
	scanf("%d",&n);
	scanf("%d",&a[1]);
	mi=ma=a[1];
	fo(i,2,n){
		scanf("%d",&a[i]);
		if (a[i]>ma) ma=a[i];
		if (a[i]<mi) mi=a[i];
	}
	if (ma-mi>1){
		printf("No\n");
		return 0;
	}
	fo(i,1,n) if (a[i]==ma) B++;else A++;
	if (ma==mi){
		if (ma+1==n||n/2>=ma) printf("Yes\n");else printf("No\n");
		return 0;
	}
	if (B/2+A>=ma&&A<ma) printf("Yes\n");else printf("No\n");
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
using ll = long long;
using namespace std;

int main(void)
{
    string s;
    cin >> s;

    reverse(s.begin(), s.end());
    int n = s.size();
    if (n == 1)
    {
        cout << s << endl;
        return 0;
    }

    ll ans = 0;
    for (int bit = 0; bit < (1 << n); ++bit)
    {
        ll t = 1;
        ll num = 0;
        ll t2 = 0;
        for (int i = 0; i < n; ++i)
        {
            if (((bit >> i) & 1) == 1)
            {
                num = (s[i] - '0') * t;
                t2 += num;

                num = 0;
                t = 1;
            }
            else
            {
                num += (s[i] - '0') * t;
                t *= 10;
            }
        }
        //cout << t2 << endl;
        ans += t2;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;
#define int long long

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

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


void solve (void)
{
  string str;cin>>str;
  int cnt = 0;
  for (auto &&i : str)
  {
    if(i == '1')cnt++;
  }
  cout<<cnt<<endl;
  
  

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

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

  return 0;
}


Measured memory_bytes: 256
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

const long MOD = 998244353;
const long INF = 1L << 59;

void main() {
    auto N = readln.chomp.to!int;
    auto G = new int[][](N);
    foreach (_; 0..N) {
        auto s = readln.split.map!(to!int);
        G[s[0] - 1] ~= s[1] - 1;
        G[s[1] - 1] ~= s[0] - 1;
    }

    auto loop = new bool[](N);
    auto used = new bool[](N);
    auto prev = new int[](N);
    fill(prev, -1);

    bool dfs(int n, int p) {
        prev[n] = p;
        used[n] = true;
        foreach (m; G[n]) {
            if (used[m] && m != p) {
                for (int x = n; ; x = prev[x]) {
                    loop[x] = true;
                    if (x == m) break;
                }
                return true;
            }
            if (m != p && dfs(m, n)) {
                return true;
            }
        }
        return false;
    }


    dfs(0, -1);
    auto Q = readln.chomp.to!int;
    while (Q--) {
        auto s = readln.split.map!(to!int);
        writeln( (loop[s[0] - 1] && loop[s[1] - 1]) ? 2 : 1 );
    }
}



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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll> > P3;

const ll MOD = ll(1e9 + 7);
const ll LLINF = LLONG_MAX;
const int IINF = INT_MAX;
const int MAX_N = int(2e5) + 5;
const double EPS = 1e-8;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
string dir = "RDLU";
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()


vector<vector<int> > g;
bool isloop[MAX_N];
int cnt[MAX_N]{};

void find_loop(int k){
    isloop[k] = false;
    for(auto v:g[k]){
        if(isloop[v]){
            cnt[k]--;
            cnt[v]--;
            if(cnt[v]==1)find_loop(v);
        }
    }
}

int main() {
    int n, q;
    cin >> n;
    g.resize(n+1);
    fill(isloop,isloop+n+1,true);
    REP(i,n){
        int u,v;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
        cnt[u]++;
        cnt[v]++;
    }

    for(int i=1;i<=n;i++){
        if(g[i].size()==1)find_loop(i);
    }
    cin >> q;
    REP(i,q){
        int a,b;
        cin >> a >> b;
        if(isloop[a] && isloop[b]){
            cout << 2 << endl;
        }
        else{
            cout << 1 << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 11780
#include <stdio.h>
#include <stdlib.h>

int main(){
	char *s = (char *)malloc(sizeof(char) * 101);
	scanf("%s", s);
	int i, j, k, n, cont;
	char c;
	for(n = 0; ; n++){
		if(s[n] == '\0'){
			break;
		}
	}
	for(k = 0; ; k++){
		for(i = 0; i < 26; i++){
			c = (char)(i + (int)'a');
			cont = -1;
			for(j = 0; j - cont - 1 <= k && j < n; j++){
				if(s[j] == c){
					cont = j;
				}
			}
			if(cont >= n - k - 1){
				printf("%d\n", k);
				return 0;
			}
		}
	}
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
   
    long long int N, M, X;
    cin >> N >> M >> X;
  long long int a[3];
  
  a[0] = N;
  a[1] = M;
  a[2] = X;
  
  sort(a,a+3);
  
   if(N%2 == 0 || M%2 == 0 || X%2 == 0){
     cout << "0" << endl;
   }
  
  else{
    cout << a[0]*a[1] << endl;
  }
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
using ll = long long;
//using mint = modint;
const int mod = 1000000007;
const double PI = acos(-1);

int main()
{
	string t;
	cin >> t;
	for (int i = 0; i < (int)t.size(); i++) {
		if (t[i] == '?') t[i] = 'D';
	}
	cout << t << endl;
}


Measured memory_bytes: 3724
// eddy1021
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long double LD;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
#define mod9 1000000009LL
#define mod7 1000000007LL
#define INF  1023456789LL
#define INF16 10000000000000000LL
#define eps 1e-9
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#ifndef ONLINE_JUDGE
#define debug(...) printf(__VA_ARGS__)
#else 
#define debug(...)
#endif
inline LL getint(){
  LL _x=0,_tmp=1; char _tc=getchar();    
  while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();
  if( _tc == '-' ) _tc=getchar() , _tmp = -1;
  while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();
  return _x*_tmp;
}
inline LL add( LL _x , LL _y , LL _mod = mod7 ){
  _x += _y;
  return _x >= _mod ? _x - _mod : _x;
}
inline LL sub( LL _x , LL _y , LL _mod = mod7 ){
  _x -= _y;
  return _x < 0 ? _x + _mod : _x;
}
inline LL mul( LL _x , LL _y , LL _mod = mod7 ){
  _x *= _y;
  return _x >= _mod ? _x % _mod : _x;
}
LL mypow( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 1LL;
  LL _ret = mypow( mul( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = mul( _ret , _a , _mod );
  return _ret;
}
LL mymul( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 0LL;
  LL _ret = mymul( add( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = add( _ret , _a , _mod );
  return _ret;
}
inline bool equal( D _x ,  D _y ){
  return _x > _y - eps && _x < _y + eps;
}
void sleep( double sec = 1021 ){
  clock_t s = clock();
  while( clock() - s < CLOCKS_PER_SEC * sec );
}
#define Bye exit(0)
int __ = 1 , _cs;
/*********default*********/
void build(){

}
#define N 8080
int x , y , len;
char c[ N ];
vector<int> vx , vy;
void init(){
  scanf( "%s" , c );
  x = getint();
  y = getint();
  bool st = false;
  int cnt = 0;
  len = strlen( c );
  int dir = 0;
  for( int i = 0 ; i <= len ; i ++ )
    if( i == len or c[ i ] == 'T' ){
      if( cnt ){
        if( not st ){
          x -= cnt;
        }else if( dir == 0 )
          vx.push_back( cnt );
        else
          vy.push_back( cnt );
      }
      st = true;
      cnt = 0;
      dir = 1 - dir;
    }else
      cnt ++;
}
bitset<(N+N)> dp[ 2 ];
bool okay( int tar , const vector<int>& cand ){
  //cerr << tar << endl;
  //for( auto i : cand )
    //cerr << i << " ";
  //cerr << endl;
  dp[ 0 ].reset();
  dp[ 0 ][ N ] = true;
  int cur = 0 , pre = 1;
  for( auto d : cand ){
    cur = 1 - cur;
    pre = 1 - pre;
    dp[ cur ].reset();
    dp[ cur ] = (dp[ pre ] << d) | (dp[ pre ] >> d);
  }
  return dp[ cur ][ N + tar ];
}
void solve(){
  if( okay( abs( x ) , vx ) and okay( abs( y ) , vy ) )
    puts( "Yes" );
  else
    puts( "No" );
}
int main(){
  build();
  //__ = getint();
  while( __ -- ){
    init();
    solve();
  }
}


Measured memory_bytes: 256
integer N
integer,allocatable,dimension(:)::d,SUMS
integer ans
read*,N
allocate(d(N),SUMS(N))
read*,d
SUMS(N)=0
do i=N-1,1,-1
  SUMS(i)=SUMS(i+1)+D(i+1)
end do
ans=0
do i=1,N
  ans=ans+SUMS(i)*D(i)
end do
print"(i0)",ans
end


Measured memory_bytes: 640
//BISMILLAHIR RAHMANIR RAHIM
#include<bits/stdc++.h>
#define PI             acos(-1.0)
#define IOS            ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ms(a,b)         memset(a, b, sizeof(a))
#define filein      freopen("input.txt", "r", stdin);
#define fileout     freopen("output.txt", "w", stdout);
#define debug       cout<<"Hello, i am in here."<<endl;
#define bit_cnt(mask) __builtin_popcountll(mask)
#define ll long long int
#define dst(u,v,x,y) sqrt((x*1.0-u*1.0)*(x*1.0-u*1.0)+(y*1.0-v*1.0)*(y*1.0-v*1.0))
using namespace std;
const int MOD = (int)1e9+7;
void solve()
{
   ll arr[100005];
   ll mark[100005]={0};
   ll n,q;
   ll sum=0;
   cin>>n;
   for(int i=1;i<=n;i++)
   {
     cin>>arr[i];
     mark[arr[i]]++;
     sum+=arr[i];
   }
   ll b,c;
   cin>>q;
   for(int i=1;i<=q;i++)
   {
     cin>>b>>c;
     ll numC=mark[b];
     ll tempSum=sum-(b*numC);
     tempSum+=(c*numC);
     mark[b]=0;
     mark[c]=numC+mark[c];
     sum=tempSum;
     cout<<tempSum<<endl;
   }

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



Measured memory_bytes: 5212
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010

const double eps = 1e-10;

bool solve(){
  int n;
  double x[100], y[100];
  vector<pair<double,double> > vec;
  
  scanf("%d",&n);
  
  if(n == 0) return false;
  
  for(int i=0;i<n;i++){
    scanf("%lf,%lf",x+i,y+i);
  }

  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      double dx = x[j]-x[i];
      double dy = y[j]-y[i];

      if(dx*dx + dy*dy <= 4 + eps){
      
        double a = (dx*dx + dy*dy + 1 - 1)/2;
        
        double cx1 = (a*dx + dy * sqrt((dx*dx+dy*dy) - a*a))/(dx*dx + dy*dy);
        double cy1 = (a*dy - dx * sqrt((dx*dx+dy*dy) - a*a))/(dx*dx + dy*dy);
        double cx2 = (a*dx - dy * sqrt((dx*dx+dy*dy) - a*a))/(dx*dx + dy*dy);
        double cy2 = (a*dy + dx * sqrt((dx*dx+dy*dy) - a*a))/(dx*dx + dy*dy);
        
        vec.push_back({cx1+x[i],cy1+y[i]});
        vec.push_back({cx2+x[i],cy2+y[i]});
      }
    }
  }

  int ans = 1;
  
  for(int i=0;i<vec.size();i++){
    int counter = 0;
    
    for(int j=0;j<n;j++){
      double dx = x[j] - vec[i].first;
      double dy = y[j] - vec[i].second;

      if(dx*dx + dy*dy <= 1 + eps){
        counter ++;
      }
      
    }

    ans = max(ans, counter);
  }

  printf("%d\n",ans);
  
  return true;
}

int main(){

  while(solve());
  
}

Measured memory_bytes: 3156
#include <bits/stdc++.h>
#include <numeric>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, n) for (int i = (a); i < (n); ++i)
using namespace std;
using ll = long long;
using uint = unsigned int;
const ll mod = (ll)1e9 + 7;

int g(int x, int y, int z) {
  return x * x + y * y + z * z + x * y + y * z + z * x;
}

int ns[100000];
int main() {
  int n;
  cin >> n;
  rep(i, 100) rep(j, 100) rep(k, 100) {
    ns[g(i + 1, j + 1, k + 1) - 1]++;
  }
  rep(i, n) cout << ns[i] << endl;

  return 0;
}


Measured memory_bytes: 3820
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
using LP=pair<ll,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353;



int main() {
    int N;
    cin>>N;
    vector<int> p(N);
    rep(i,N)cin>>p.at(i);
    sort(p.begin(),p.end());
    ll ans=0;
    rep(i,N){
        if(i==N-1)ans+=p.at(i)/2;
        else ans+=p.at(i);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3648
import Control.Applicative
import Control.Monad
import Data.List
import Data.Char
strToInt s = (read :: String -> Int) s
strToInteger s = (read :: String -> Integer) s
strToDouble s = (read :: String -> Double) s

main :: IO ()
main = do
    -- スペース区切り整数の入力
    [a, b, c] <- words <$> getLine
    -- 出力
    putStrLn $ if last a == head b && last b == head c then "YES" else "NO"


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

typedef long long lli;
typedef vector<int> Vi;
typedef vector<lli> Vl;
typedef pair<int, int> Pii;
typedef pair<lli, lli> Pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<": ";REP(i,v.size())cout<<" "<<v[i];cout<<endl

#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))


//===


int main()
{
	int N, Q;
	cin >> N >> Q;
	string s;
	cin >> s;
	vector<char> t(Q), d(Q);
	REP(i, Q) {
		cin >> t[i] >> d[i];
	}
	int il, ir;

	int left = -1, right = N;
	while (right - left > 1) {
		int mid = (right + left) / 2;
		int a = mid;
		REP(i, Q) {
			if (a < 0 || a >= N) break;
			if (s[a] == t[i]) {
				if (d[i] == 'L') --a;
				else ++a;
			}
		}
		if (a == -1) left = mid;
		else right = mid;
	}
	il = left;

	left = -1, right = N;
	while (right - left > 1) {
		int mid = (right + left) / 2;
		int a = mid;
		REP(i, Q) {
			if (a < 0 || a >= N) break;
			if (s[a] == t[i]) {
				if (d[i] == 'L') --a;
				else ++a;
			}
		}
		if (a == N) right = mid;
		else left = mid;
	}
	ir = right;

	cout << ir - il - 1 << endl;
}

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

int main()
{

  long long N, H, W;
  long long count = 0;

  cin >> N >> H >> W;

  long long A[N], B[N];

  for (long long i = 0; i < N; i++)
  {

    cin >> A[i] >> B[i];

    if (A[i] >= H && B[i] >= W)
      count++;
  }

  cout << count << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
///数字はASCIIの番号
int main()
{
	std::string s;
	getline(std::cin, s);
	for (int i = 0;i <= s.size();++i) {
		if (s[i] >= 97 && s[i] <= 122) {
			s[i] = 'A' + (s[i] - 'a');
		}
		else if (s[i] >= 65 && s[i] <= 92) {
			s[i] = 'a' + (s[i] - 'A');
		}
	}
	std::cout << s << std::endl;
	return 0;
}


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

const int INF  = 0x3f3f3f3f;
const int MAXN = 1e3+7;

int main() {
        int a,b;
        while(cin>>a>>b) {
                int ans = 0,num = 0;
                // num = (b-1)/(a-1);
                while(ans<b) {
                        num++;
                        if(ans+a<b)     ans += a-1;
                        else            ans += a;
                }
                if(b==1)        num = 0;
                cout<<num<<endl;
        }
        return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int num[10]; 
char str[5];
int main(){
	scanf("%s",str);
	for(int i=1;i<4;i++){
		if(str[i]==str[i-1]){
			puts("Bad");
			return 0;
		}
	}
	puts("Good");
	return 0;
}

Measured memory_bytes: 256
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element? {
        return self.maxElement()
    }
    func min() -> Element? {
        return self.minElement()
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
//    func enumerated() -> [(Int, Element)] {
//        return self.enumerate()
//    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/

//func gcd(x: Int, _ y: Int) -> Int {
//    if y == 0 {
//        return x
//    } else {
//        return gcd(y, x%y)
//    }
//}
//func lcm(x: Int, _ y: Int) -> Int {
//    return x * y / gcd(x, y)
//}

/*************** メインプログラム ***************/

let S = readInt()!
let Y = S / 100
let M = S % 100
var ans = "YYMM"
if M > 12 || M == 0 {
    if Y > 12 || Y == 0 {
        ans = "NA"
    } else {
        ans = "MMYY"
    }
} else if Y > 0 && Y <= 12{
    ans = "AMBIGUOUS"
}
print(ans)


Measured memory_bytes: 6884
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 100000000;
const ll half_inf = 0x3f3f3f3f;
const ll inf = 0x7fffffff;
const ll mod = 998244353;
const ll maxn = 2000005;
int a,b,c,k; 
int main(){
	scanf("%d%d%d%d",&a,&b,&c,&k);
	ll sum=0;
	if(k<=a){
		printf("%d",k);
	}
	else{
		if(k<=a+b){
			printf("%d",a);
			
		}
		else{
			printf("%d",a-(k-a-b));
		}
	}
	

	
	return 0;
}





Measured memory_bytes: 3828
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        for _ in range(num): return []
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list,zip(*read_all))

#################

from operator import itemgetter
from bisect import bisect_left

class Range_SegmentTree:
    def __init__(self,N):
        self.N0 = 2**(N-1).bit_length()
        self.tree = [None]*(2*self.N0)    
        self.INF = (-1, 2**31-1)

    #区間[l,r]の値をvに書き換える
    #vは(t,value)という値にする (新しい値ほどtは大きくなる)
    def update(self,l,r,v):
        L = l + self.N0; R = r + self.N0 + 1
        while L < R:
            if R & 1:
                R -= 1
                self.tree[R-1] = v
            if L & 1:
                self.tree[L-1] = v
                L += 1
            L >>= 1; R >>= 1

    #a[k]の現在の値を更新時刻と共に取得
    def _query(self,k):
        k += self.N0-1
        s = self.INF
        while k >= 0:
            if self.tree[k]:
                s = max(s, self.tree[k])
            k = (k - 1) // 2
        return s

    #a[k]を返す
    def query(self,k):
        return self._query(k)[1]
      
N,Q = II()
a = []
for _ in range(N):
    s,t,x = II()
    a.append((x, s-x-0.5, t-x-0.5))
D = Line(Q,1)
 
a.sort(key=itemgetter(0),reverse=True)
 
seg = Range_SegmentTree(Q)
for i,b in enumerate(a):
    l = bisect_left(D,b[1])
    r = bisect_left(D,b[2])
    seg.update(l,r-1,(i,b[0]))
    
for i in range(Q):
    x = seg.query(i)
    if x == 2**31-1:
        print(-1)
    else:
        print(x)

Measured memory_bytes: 118144
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
#include <cmath>

using namespace std;

int main() {
    string s;
    cin >> s;

    int count = 0;
    int prev_count = 0;
    for (int i = 0; i < s.length(); ++i) {
        if (i == 0) {
            if (s[i] == 'R') {
                count++;
            }
        }
        else {
            if (s[i] == 'R' && s[i - 1] == 'R') {
                count++;
            }
            if (s[i] == 'R' && s[i - 1] != 'R') {
                if (count > prev_count) {
                    prev_count = count;
                }
                count = 1;
            }
        }
    }
    
    cout << max(count, prev_count);
}

Measured memory_bytes: 3600
#include <iostream>
using namespace std;
int main(void){
    
    int a,b;
    cin >> a >> b;
    int sum,sa,kakeru,max;
    sum = a+b;
    sa = a-b;
    kakeru = a*b;
    
    max = sum;
    if(sa > max)max = sa;
    if(kakeru > max)max = kakeru;
    
    cout << max;
}


Measured memory_bytes: 256
# 初期入力
S =input()

#
flag = True

for i,v in enumerate(S):
    if (i+1) %2 ==1 and v in "RUD":
        flag ="Yes"
    elif(i+1) %2 ==1 and v not in "RUD":
        flag ="No"
        break
    if (i+1) %2 ==0 and v in "LUD":
        flag ="Yes"
    elif(i+1) %2 ==0 and v not in "LUD":
        flag ="No"
        break
print(flag)

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

#define pb push_back
#define sz(X) ((int)(X).size())
#define all(X) (X).begin(),(X).end()
#define ll long long
#define pi pair<int,int>
const int N=1e5+5,MOD=100;

using namespace std;
int n,k;
string a;
int howmany(int x){
	int ret = 0;
	while(x<k){
		x*=2;
		ret++;
	}
	return ret;
}
double power(int x){
	double ret = 0.5;

	for(int i=1;i<x;i++)ret*=0.5;
	return ret;
}
int col[N];
std::vector<pi> g[N];
void dfs(int u,int p){

	for(auto pp : g[u]){

		int v = pp.first , cst = pp.second;
		if(v == p)continue;
		if(cst%2){
			col[v]=!col[u];
		}
		else{
			col[v]=col[u];
		}

		dfs(v,u);
	}
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	scanf("%d",&n);

	for(int i=1,a,b,w;i<n;i++){

		scanf("%d %d %d",&a,&b,&w);

		g[a].pb({b,w});
		g[b].pb({a,w});
	}
	col[1]=1;
	dfs(1,-1);

	for(int i=1;i<=n;i++)printf("%d\n",col[i] );
}


Measured memory_bytes: 8448